當前位置: 首頁>>代碼示例>>C#>>正文


C# SceneObjectPart.UpdateOffSet方法代碼示例

本文整理匯總了C#中OpenSim.Region.Framework.Scenes.SceneObjectPart.UpdateOffSet方法的典型用法代碼示例。如果您正苦於以下問題:C# SceneObjectPart.UpdateOffSet方法的具體用法?C# SceneObjectPart.UpdateOffSet怎麽用?C# SceneObjectPart.UpdateOffSet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenSim.Region.Framework.Scenes.SceneObjectPart的用法示例。


在下文中一共展示了SceneObjectPart.UpdateOffSet方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetPos

        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();
            }
        }
開發者ID:mugginsm,項目名稱:Aurora-Sim,代碼行數:37,代碼來源:LSL_Api.cs

示例2: SetPos

        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();
                }
            }
        }
開發者ID:Ideia-Boa,項目名稱:diva-distribution,代碼行數:35,代碼來源:LSL_Api.cs


注:本文中的OpenSim.Region.Framework.Scenes.SceneObjectPart.UpdateOffSet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。