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


C# Body.SetPositionOrientation方法代碼示例

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


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

示例1: PhysicsNode

        public PhysicsNode(SimNode simNode, State State)
            : base(simNode.SceneNode)
        {
            SceneNode = simNode.SceneNode;
            SceneNode child = SceneNode;
            while (child.NumChildren() > 0) child = child.GetChild(0) as SceneNode;

            var hull = new MogreNewt.CollisionPrimitives.ConvexHull(State.PhysicsWorld.World, child, child.Orientation, 0.002f, SceneNode.Name.GetHashCode());
            Body = new Body(State.PhysicsWorld.World, hull);
            Body.AttachNode(SceneNode);
            Body.IsGravityEnabled = true;

            Body.SetPositionOrientation(SceneNode._getDerivedPosition(), SceneNode.Orientation); // REALPosition Orient
            Body.ForceCallback += State.PhysicsWorld.ForceCallback;
            //            Body.AngularDamping = new Vector3(1,1,1);
            //            Body.LinearDamping = 1;
            Body.UserData = new PhysicsControlData();
            hull.Dispose();
        }
開發者ID:crescent,項目名稱:SubmarineSim3D,代碼行數:19,代碼來源:PhysicsNode.cs

示例2: Init

        public void Init(State State)
        {
            this.State = State;
            State.PhysicsWorld = this;
            World = new MogreNewt.World();
            World.SetPlatformArchitecture(MogreNewt.World.PlatformArchitecture.PA_BEST_HARDWARE);
            World.SetWorldSize(new Vector3(-500, -500, -500), new Vector3(500, 500, 500));
            World.SetSolverModel(MogreNewt.World.SolverModelMode.SM_2_PASS);
            World.DebuggerInstance.Init(State.SceneManager);

            // using the new "SceneParser" TreeCollision primitive.  this will automatically parse an entire tree of
            // SceneNodes (parsing all children), and add collision for all meshes in the tree.
            var statCol = new MogreNewt.CollisionPrimitives.TreeCollisionSceneParser(World);
            statCol.ParseScene(State.SceneManager.RootSceneNode, true, 0); // was floornode
            var sceneBody = new Body(World, statCol);
            statCol.Dispose();

            sceneBody.AttachNode(State.SceneManager.RootSceneNode); // was floornode
            sceneBody.SetPositionOrientation(new Vector3(0.0f, 0.0f, 0.0f), Quaternion.IDENTITY);

            var ent = State.SceneManager.CreateEntity("cylinder_body", "mocksub.mesh");
            var simNode = new SimNode(State.SceneManager.RootSceneNode, ent);

            // rigid body.
            var phyNode = new PhysicsNode(simNode, State);

            phyNode.Body.SetPositionOrientation(new Vector3(0, 10, 0), Quaternion.IDENTITY);
            phyNode.Body.SetMassMatrix(125, Vector3.ZERO);

            var physicsNode = new PhysicsNode(State.SubNode, State);
            physicsNode.Body.SetMassMatrix(125, Vector3.ZERO);
            // TODO: FIX THIS State.SubNode = physicsNode;

            // initial position
            State.Root.FrameStarted += NewtonUpdate;
        }
開發者ID:crescent,項目名稱:SubmarineSim3D,代碼行數:36,代碼來源:PhysicsWorld.cs


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