UpdateOffSet() публичный Метод

public UpdateOffSet ( Vector3 pos ) : void
pos Vector3
Результат void
Пример #1
0
        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();
            }
        }
Пример #2
0
        protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
        {
            // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
            LSL_Vector currentPos = llGetLocalPos();

            float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y);
            bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true);

            if (part.ParentGroup == null)
            {
                if ((targetPos.z < ground) && disable_underground_movement)
                    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)
            {
                if ((targetPos.z < ground) && disable_underground_movement)
                    targetPos.z = ground;
                SceneObjectGroup parent = part.ParentGroup;
                LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
                parent.UpdateGroupPosition(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z));
            }
            else
            {
                //it's late... i think this is right ?
                if (llVecDist(new LSL_Vector(0,0,0), targetPos) <= 10.0f)
                {
                    part.OffsetPosition = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z);
                    SceneObjectGroup parent = part.ParentGroup;
                    parent.HasGroupChanged = true;
                    parent.ScheduleGroupForTerseUpdate();
                }
            }
        }