OpenSim.Region.Framework.Scenes.SceneObjectPart.UpdateOffSet C# (CSharp) Method

UpdateOffSet() public method

public UpdateOffSet ( Vector3 pos ) : void
pos Vector3
return void
        public void UpdateOffSet(Vector3 pos)
        {
            if ((pos.X != OffsetPosition.X) ||
                (pos.Y != OffsetPosition.Y) ||
                (pos.Z != OffsetPosition.Z))
            {
                Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);

                if (ParentGroup.RootPart.GetStatusSandbox())
                {
                    if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10)
                    {
                        ParentGroup.RootPart.ScriptSetPhysicsStatus(false);
                        newPos = OffsetPosition;
                        ParentGroup.Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
                              ChatTypeEnum.DebugChannel, 0x7FFFFFFF, ParentGroup.RootPart.AbsolutePosition, Name, UUID, false);
                    }
                }

                OffsetPosition = newPos;
                ScheduleTerseUpdate();
            }
        }

Usage Example

コード例 #1
0
ファイル: LSL_Api.cs プロジェクト: mugginsm/Aurora-Sim
        protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
        {
            // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
            LSL_Vector currentPos = GetPartLocalPos(part);
            float ground = 0;
            bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true);

            ITerrainChannel heightmap = World.RequestModuleInterface<ITerrainChannel>();
            if(heightmap != null)
                ground = heightmap.GetNormalizedGroundHeight((float)targetPos.x, (float)targetPos.y);
            if (part.ParentGroup == null)
            {
                if (ground != 0 && (targetPos.z < ground) && disable_underground_movement && m_host.AttachmentPoint == 0)
                    targetPos.z = ground;
                    LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
                    part.UpdateOffSet(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z));
            }
            else if (part.ParentGroup.RootPart == part)
            {
                SceneObjectGroup parent = part.ParentGroup;
                if (!part.IsAttachment)
                {
                    if (ground != 0 && (targetPos.z < ground) && disable_underground_movement)
                        targetPos.z = ground;
                }
                LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
                parent.UpdateGroupPosition(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z), true);
            }
            else
            {
                LSL_Vector rel_vec = SetPosAdjust(currentPos, targetPos);
                part.FixOffsetPosition((new Vector3((float)rel_vec.x, (float)rel_vec.y, (float)rel_vec.z)),true);
                SceneObjectGroup parent = part.ParentGroup;
                parent.HasGroupChanged = true;
                parent.ScheduleGroupTerseUpdate();
            }
        }
All Usage Examples Of OpenSim.Region.Framework.Scenes.SceneObjectPart::UpdateOffSet
SceneObjectPart