Пример #1
0
        /// <summary>
        /// This method loads the mesh and attaches it to a node and to the schenegraph
        /// </summary>
        private void Load()
        {
            robotEntity = mSceneMgr.CreateEntity("robot.mesh");
            robotNode = mSceneMgr.CreateSceneNode();
            robotNode.AttachObject(robotEntity);
            //mSceneMgr.RootSceneNode.AddChild(robotNode);

            controlNode = mSceneMgr.CreateSceneNode();
            controlNode.AddChild(robotNode);
            mSceneMgr.RootSceneNode.AddChild(controlNode);

            float radius = 50;
            controlNode.Position += radius * Vector3.UNIT_Y;
            robotNode.Position -= radius * Vector3.UNIT_Y;

            physObj = new PhysObj(radius, "Robot", 0.1f, 0.2f, 0.5f);
            physObj.SceneNode = controlNode;
            physObj.Position = controlNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
Пример #2
0
        /// <summary>
        /// This method loads the nodes and entities needed by the compound model
        /// </summary>
        protected override void LoadModelElements()
        {
            hullGroup = mSceneMgr.CreateSceneNode();
            wheelGroup = mSceneMgr.CreateSceneNode();
            gunGroup = mSceneMgr.CreateSceneNode();

            mainHull = mSceneMgr.CreateSceneNode();
            hullEntity = mSceneMgr.CreateEntity("Main.mesh");
            hullEntity.GetMesh().BuildEdgeList();

            sphere = mSceneMgr.CreateSceneNode();
            sphereEntity = mSceneMgr.CreateEntity("Sphere.mesh");
            sphereEntity.GetMesh().BuildEdgeList();

            powerCells = mSceneMgr.CreateSceneNode();
            powerCellsEntity = mSceneMgr.CreateEntity("PowerCells.mesh");
            powerCellsEntity.GetMesh().BuildEdgeList();

            model = mSceneMgr.CreateSceneNode();

            float radius = 50;
            model.Position += radius * Vector3.UNIT_Y;
            hullGroup.Position -= radius * Vector3.UNIT_Y;

            physObj = new PhysObj(radius, "PlayerModel", 0.1f, 0.21f, 0.1f);
            physObj.SceneNode = model;
            physObj.Position = model.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
Пример #3
0
        /// <summary>
        /// This method load the bomb mesh and its physics object
        /// </summary>
        private void Load()
        {
            removeMe = false;
            bombEntity = mSceneMgr.CreateEntity("Bomb.mesh");

            bombNode = mSceneMgr.CreateSceneNode();
            bombNode.Scale(2, 2, 2);
            bombNode.AttachObject(bombEntity);
            mSceneMgr.RootSceneNode.AddChild(bombNode);

            physObj = new PhysObj(10, "Bomb", 0.1f, 0.5f);
            physObj.SceneNode = bombNode;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));

            Physics.AddPhysObj(physObj);
        }