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


C# SceneObjectPart.IsBallJoint方法代碼示例

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


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

示例1: jointCreate

        public void jointCreate(SceneObjectPart part)
        {
            // by turning a joint proxy object physical, we cause creation of a joint in the ODE scene.
            // note that, as a special case, joints have no bodies or geoms in the physics scene, even though they are physical.

            PhysicsJointType jointType;
            if (part.IsHingeJoint())
            {
                jointType = PhysicsJointType.Hinge;
            }
            else if (part.IsBallJoint())
            {
                jointType = PhysicsJointType.Ball;
            }
            else
            {
                jointType = PhysicsJointType.Ball;
            }

            List<string> bodyNames = new List<string>();
            string RawParams = part.Description;
            string[] jointParams = RawParams.Split(" ".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);
            string trackedBodyName = null;
            if (jointParams.Length >= 2)
            {
                for (int iBodyName = 0; iBodyName < 2; iBodyName++)
                {
                    string bodyName = jointParams[iBodyName];
                    bodyNames.Add(bodyName);
                    if (bodyName != "NULL")
                    {
                        if (trackedBodyName == null)
                        {
                            trackedBodyName = bodyName;
                        }
                    }
                }
            }

            SceneObjectPart trackedBody = GetSceneObjectPart(trackedBodyName); // FIXME: causes a sequential lookup
            Quaternion localRotation = Quaternion.Identity;
            if (trackedBody != null)
            {
                localRotation = Quaternion.Inverse(trackedBody.RotationOffset) * part.RotationOffset;
            }
            else
            {
                // error, output it below
            }

            PhysicsJoint joint;

            joint = m_scene.PhysicsScene.RequestJointCreation(part.Name, jointType,
                part.AbsolutePosition,
                part.RotationOffset,
                part.Description,
                bodyNames,
                trackedBodyName,
                localRotation);

            if (trackedBody == null)
            {
                jointErrorMessage(joint, "warning: tracked body name not found! joint location will not be updated properly. joint: " + part.Name);
            }
        }
開發者ID:kow,項目名稱:Aurora-Sim,代碼行數:65,代碼來源:NinjaPhysicsModule.cs


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