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;
        }
Example #2
0
        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;
        }