当前位置: 首页>>代码示例>>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;未经允许,请勿转载。