Example #1
0
        /// <summary>
        // The colour material is attached to the bomb mesh. The model is repositioned again next to the player in the scene later on. The PhysObj attached here
        /// </summary>
        protected override void Load()  //In the class override the Load method
        {
            base.Load();


            //in its body initialize the gameEntity, and the gameNode for the projectile
            Model    = new ModelElement(mSceneMgr, "Bomb.mesh");
            gameNode = Model.GameNode;
            mSceneMgr.RootSceneNode.AddChild(gameNode);


            gameNode.Scale(new Vector3(1.4f, 1.4f, 1.4f));    //scale down the size of the projectile models

            gameNode.SetPosition(200, 200, 20);

            physObj           = new PhysObj(3f, "Bomb", 0.1f, 0.7f, 25f);
            physObj.SceneNode = gameNode;                             //set its sceneNode property to gameNode
            physObj.Position  = gameNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass)); //add a weight force
            physObj.AddForceToList(new FrictionForce(physObj));


            //physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
Example #2
0
        /// <summary>
        // The robot mesh is loaded. The model is positioned randomly in the scene and PhysObj attached here
        /// </summary>
        protected override void LoadModelElements()
        {
            base.LoadModelElements();
            Model = new ModelElement(mSceneMgr, "robot.mesh");

            controlNode = mSceneMgr.CreateSceneNode();

            float radius = 30;

            controlNode.Position    += radius * Vector3.UNIT_Y;
            Model.GameNode.Position -= (radius * Vector3.UNIT_Y);
            if (isBoss)
            {
                Model.GameNode.Position -= new Vector3(0f, -9f, 0f);    //set model to be above the ground
            }

            controlNode.SetPosition(Mogre.Math.RangeRandom(-450, 450), 0, Mogre.Math.RangeRandom(-450, 450));

            GameNode = controlNode;

            if (isBoss)
            {
                controlNode.Scale(new Vector3(1.7f, 1.7f, 1.7f));
            }

            physObj           = new PhysObj(30f, "Robot", 10f, 0.3f, 5f);
            physObj.SceneNode = controlNode;
            physObj.Position  = controlNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
Example #3
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);
        }
Example #4
0
        /// <summary>
        // After defining the ModelElements they are initialized in the LoadModelElements method. The model is positioned and PhysObj attached here
        /// </summary>
        protected override void LoadModelElements()
        {
            Model = new ModelElement(mSceneMgr);

            HullGroupNode  = new ModelElement(mSceneMgr);
            WheelGroupNode = new ModelElement(mSceneMgr);
            GunGroupNode   = new ModelElement(mSceneMgr);
            PowerCells     = new ModelElement(mSceneMgr, "PowerCells.mesh");
            Hull           = new ModelElement(mSceneMgr, "Main.mesh");

            Sphere = new ModelElement(mSceneMgr, "Sphere.mesh");

            float radius = 9;

            //physics for player
            controlNode              = mSceneMgr.CreateSceneNode();
            controlNode.Position    += radius * Vector3.UNIT_Y;
            Model.GameNode.Position -= (radius * Vector3.UNIT_Y);
            Model.GameNode.Position -= new Vector3(0f, -8f, 0f);    //set model to be above the ground

            //controlNode.SetPosition(0, 140, 0);


            physObj           = new PhysObj(radius, "Player", 1f, 0.3f, 0.7f);
            physObj.SceneNode = controlNode;
            physObj.Position  = controlNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
Example #5
0
        /// <summary>
        // The material is attached to the powerup mesh. The model is positioned randomly in the scene and PhysObj attached here
        /// </summary>
        protected override void LoadModel() //The class should override the LoadModel method from PowerUp
        {
            //load the geometry for the power up and the scene graph nodes
            base.LoadModel();
            timePickUpEntity = mSceneMgr.CreateEntity("Watch.mesh");
            timePickUpEntity.SetMaterialName("clockPickup");


            timePickUpNode = mSceneMgr.CreateSceneNode();
            timePickUpNode.Scale(new Vector3(0.3f, 0.3f, 0.3f));
            timePickUpNode.SetPosition(Mogre.Math.RangeRandom(-450, 450), 150, Mogre.Math.RangeRandom(-450, 450));

            timePickUpNode.AttachObject(timePickUpEntity);


            mSceneMgr.RootSceneNode.AddChild(timePickUpNode);



            timePickUpEntity.GetMesh().BuildEdgeList();

            physObj           = new PhysObj(6f, "TimePickUp", 0.1f, 0.3f, 20f);
            physObj.SceneNode = timePickUpNode;
            physObj.Position  = timePickUpNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
Example #6
0
        /// <summary>
        // The material is attached to the powerup mesh. The model is positioned randomly in the scene and PhysObj attached here
        /// </summary>
        protected override void LoadModel() //The class should override the LoadModel method from PowerUp
        {
            //load the geometry for the power up and the scene graph nodes
            base.LoadModel();
            lifePickUpEntity = mSceneMgr.CreateEntity("Heart.mesh");
            lifePickUpEntity.SetMaterialName("HeartHMD");


            lifePickUpNode = mSceneMgr.CreateSceneNode();
            lifePickUpNode.Scale(new Vector3(5f, 5f, 5f));
            lifePickUpNode.SetPosition(Mogre.Math.RangeRandom(-450, 450), 150, Mogre.Math.RangeRandom(-450, 450));

            lifePickUpNode.Position += 3 * Vector3.UNIT_Y;
            lifePickUpNode.Position -= new Vector3(0f, -8f, 0f);
            //Model.GameNode.Position -= (3 * Vector3.UNIT_Y);
            //Model.GameNode.Position -= new Vector3(0f, -80f, 0f);

            lifePickUpNode.AttachObject(lifePickUpEntity);


            mSceneMgr.RootSceneNode.AddChild(lifePickUpNode);



            lifePickUpEntity.GetMesh().BuildEdgeList();

            physObj           = new PhysObj(9f, "LifePickUp", 0.1f, 0.3f, 20f);
            physObj.SceneNode = lifePickUpNode;
            physObj.Position  = lifePickUpNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
Example #7
0
        protected virtual void LoadModel()
        {
            float radius = 5;

            p2 = physObj = new PhysObj(radius, "Gem", 0.1f, 0.5f, 0.0001f);
            physObj.SceneNode = gameNode;
            physObj.Position  = gameNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            //physObj.AddForceToList(new ElasticForce(p2, physObj));
            Physics.AddPhysObj(physObj);
        }
Example #8
0
        protected override void LoadModel()
        {
            RemoveMe = false;

            blueGemElement = new ModelElement(mSceneMgr, "Gem.mesh");
            blueGemElement.GameNode.Scale(2, 2, 2);
            mSceneMgr.RootSceneNode.AddChild(blueGemElement.GameNode);

            physObj = new PhysObj(10, "Gem", 0.1f, 0.5f, 5f);
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            physObj.SceneNode = blueGemElement.GameNode;
            Physics.AddPhysObj(physObj);
        }
Example #9
0
        virtual protected void Load()
        {
            // Physics
            float radius = 10;

            //sProjNode.Position -= radius * Vector3.UNIT_Y;

            physObj           = new PhysObj(radius, "Projectile", 0.1f, 0.7f, 0.3f);
            physObj.SceneNode = gameNode;
            physObj.Position  = gameNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));//Friction

            Physics.AddPhysObj(physObj);
        }
Example #10
0
        protected override void LoadModel()
        {
            RemoveMe = false;

            redGemElement = new ModelElement(mSceneMgr, "Gem.mesh");
            redGemElement.GameEntity.SetMaterialName("Red");
            redGemElement.GameNode.Scale(2, 2, 2);
            mSceneMgr.RootSceneNode.AddChild(redGemElement.GameNode);

            physObj           = new PhysObj(10, "Gem", 0.1f, 0.5f);
            physObj.SceneNode = redGemElement.GameNode;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
        protected override void LoadModel()
        {
            base.LoadModel();
            pUEntity = mSceneMgr.CreateEntity("Sphere.mesh");
            pUNode   = mSceneMgr.CreateSceneNode();
            pUNode.Scale(0.5f, 0.5f, 0.5f);
            pUNode.AttachObject(pUEntity);



            controlNode = mSceneMgr.CreateSceneNode();
            controlNode.AddChild(pUNode);

            mSceneMgr.RootSceneNode.AddChild(controlNode);

            float radius = 0.5f;

            controlNode.Position += radius * Vector3.UNIT_Y;
            pUNode.Position      -= radius * Vector3.UNIT_Y;

            physObj           = new PhysObj(radius, "Ball", 0.1f, 0.7f, 0.3f);
            physObj.SceneNode = controlNode;
            physObj.Position  = controlNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            Physics.AddPhysObj(physObj);

            physObj.SceneNode = pUNode;

            pUEntity.GetMesh().BuildEdgeList();
        }
        public CollectableGun(SceneManager mSceneMgr, Gun gun, Armoury playerArmoury, Vector3 position)
        {
            // Initialize here the mSceneMgr, the gun and the playerArmoury fields to the values passed as parameters

            this.mSceneMgr     = mSceneMgr;
            this.gun           = gun;
            this.playerArmoury = playerArmoury;
            // Initialize the gameNode here, scale it by 1.5f using the Scale funtion, and add as its child the gameNode contained in the Gun object.
            // Finally attach the gameNode to the sceneGraph.
            //gunNode = new ModelElement(mSceneMgr);
            //gunNode.GameNode.Scale(new Vector3(1.5f, 1.5f, 1.5f));
            //gunNode.GameNode.AddChild(gun.GameNode);

            gameNode = mSceneMgr.CreateSceneNode();
            gameNode.AddChild(gun.modelNode);
            gameNode.Position = position;
            mSceneMgr.RootSceneNode.AddChild(gameNode);

            // Here goes the link to the physics engine
            // (ignore until week 8) ...
            physObj           = new PhysObj(10, "CollectableGun", 0.01f, 0.7f, 0.3f);
            physObj.SceneNode = gameNode;
            physObj.Position  = gameNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            Physics.AddPhysObj(physObj);
        }
Example #13
0
        protected override void AssembleModel()
        {
            controlNode.AddChild(modelNode.GameNode);
            modelNode.AddChild(hullGroupNode.GameNode);
            hullGroupNode.AddChild(power.GameNode);
            hullGroupNode.AddChild(hull.GameNode);

            hullGroupNode.AddChild(gunsGroupNode.GameNode);
            hullGroupNode.AddChild(weelsGroupNode.GameNode);

            weelsGroupNode.AddChild(sphere.GameNode);

            mSceneMgr.RootSceneNode.AddChild(controlNode.GameNode);

            float radius = 10;

            //     controlNode.GameNode.Position += radius * Vector3.UNIT_Y;
            //       modelNode.GameNode.Position += radius * Vector3.UNIT_Y;
            gameNode          = controlNode.GameNode;
            physObj           = new PhysObj(radius, "Player", 0.01f, 0.7f, 0.3f);
            physObj.SceneNode = controlNode.GameNode;
            physObj.Position  = controlNode.GameNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            Physics.AddPhysObj(physObj);
        }
Example #14
0
        protected override void AssembleModel()
        {
            // Attach and assemble model
            wheelsGroupNode.AddChild(playerSphereNode.GameNode);

            hullGroupNode.AddChild(playerCellsNode.GameNode);
            hullGroupNode.AddChild(playerMainNode.GameNode);
            hullGroupNode.AddChild(wheelsGroupNode);
            hullGroupNode.AddChild(gunGroupNode);

            modelNode.AddChild(hullGroupNode);

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

            float radius = 12;

            controlNode.Position += radius * Vector3.UNIT_Y;
            modelNode.Position   -= radius * Vector3.UNIT_Y;

            physObj           = new PhysObj(radius, "Player", 0.1f, 0.7f, 0.3f);
            physObj.SceneNode = controlNode;
            physObj.Position  = controlNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            //physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
            this.gameNode = controlNode;

            //base.AssembleModel();
        }
        protected override void AssembleModel()
        {
            hullGroupElement.AddChild(powerElement.GameNode);
            hullGroupElement.AddChild(wheelsGroupElement.GameNode);
            hullGroupElement.AddChild(gunGroupElement.GameNode);

            model.AddChild(hullGroupElement.GameNode);

            gameNode = model.GameNode;

            physObj = new PhysObj(10, "Player", 0.1f, 0.5f, 0.3f);

            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));

            physObj.SceneNode = gameNode;
            Physics.AddPhysObj(physObj);
        }
Example #16
0
        protected virtual void LoadModel()
        {
            remove  = false;
            physObj = new PhysObj(7, "Gem", 0.3f, 0.5f);
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.SceneNode = gameNode;

            Physics.AddPhysObj(physObj);
        }
Example #17
0
        protected override void LoadModel()
        {
            base.LoadModel();
            this.gameNode   = mSceneMgr.CreateSceneNode();
            this.gameEntity = mSceneMgr.CreateEntity("Sphere.mesh");
            this.gameEntity.SetMaterialName("RedSphere");
            //this.gameEntity.GetMesh().BuildEdgeList();
            this.gameNode.AttachObject(gameEntity);
            mSceneMgr.RootSceneNode.AddChild(gameNode);
            float radius = 10;

            physObj           = new PhysObj(radius, "HealthPU", 0.1f, 0.7f, 0.3f);
            physObj.SceneNode = gameNode;
            physObj.Position  = gameNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
Example #18
0
        /// <summary>
        /// This method assemble the model attaching the entities to
        /// each node and appending the nodes to each other
        /// </summary>
        protected override void AssembleModel()
        {
            mainHull.AddChild(sphere.getModel());
            mainHull.AddChild(power.getModel());
            model.AddChild(mainHull.getModel());
            model.AddChild(gunGroupNode);
            mSceneMgr.RootSceneNode.AddChild(model);
            GameNode = model;
            float radius = 5;

            physObj           = new PhysObj(radius, "Player", 1f, 0.7f, 1f);
            physObj.SceneNode = gameNode;
            physObj.Position  = gameNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));

            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
Example #19
0
        /// <summary>
        /// This method loads the mesh and attaches it to a node and to the schenegraph
        /// </summary>
        private void Load()
        {
            removeMe     = false;
            robotElement = new ModelElement(mSceneMgr, "robot.mesh");

            float radius = 10;

            robotElement.GameNode.Position -= radius * Vector3.UNIT_Y;

            mSceneMgr.RootSceneNode.AddChild(robotElement.GameNode);

            physObj           = new PhysObj(radius, "Robot", 0.1f, 0.7f, 0.3f);
            physObj.SceneNode = robotElement.GameNode;

            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
Example #20
0
        protected override void LoadModel()
        {
            base.LoadModel();
            this.gameNode   = mSceneMgr.CreateSceneNode();
            this.gameEntity = mSceneMgr.CreateEntity("Heart.mesh");
            this.gameEntity.SetMaterialName("HeartHMD");
            this.gameEntity.GetMesh().BuildEdgeList();
            this.gameNode.AttachObject(gameEntity);
            this.gameNode.Scale(new Vector3(15f, 15f, 15f));
            mSceneMgr.RootSceneNode.AddChild(gameNode);
            float radius = 10;

            physObj           = new PhysObj(radius, "LifePU", 0.2f, 0.7f, 0.3f);
            physObj.SceneNode = gameNode;
            physObj.Position  = gameNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            //physObj.AddForceToList(new ElasticForce(new PhysObj(), physObj));
            Physics.AddPhysObj(physObj);
        }
Example #21
0
        //Initialize the mSceneMgr, the gun and the playerArmoury fields to the values passed as parameters
        public CollectableGun(SceneManager mSceneMgr, Gun g, Armoury pArmoury)
        {
            // Initialize here the mSceneMgr, the gun and the playerArmoury fields to the values passed as parameters
            this.mSceneMgr     = mSceneMgr;
            this.gun           = g;
            this.playerArmoury = pArmoury;

            gameNode = mSceneMgr.CreateSceneNode();         //Initialize the gameNode here
            gameNode.SetPosition(Mogre.Math.RangeRandom(-450, 450), 150, Mogre.Math.RangeRandom(-450, 450));

            gameNode.AddChild(gun.GameNode);                //add as its child the gameNode contained in the Gun object
            mSceneMgr.RootSceneNode.AddChild(gameNode);     //Finally attach the gameNode to the sceneGraph.

            //initialize the physics object and add a weight and friction force to it
            physObj           = new PhysObj(14f, "CollectableGun", 0.1f, 0.3f, 15f);
            physObj.SceneNode = gameNode;
            physObj.Position  = gameNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
Example #22
0
        protected override void LoadModel()
        {
            RemoveMe = false;

            shieldElement = new ModelElement(mSceneMgr, "Shield.mesh");
            mSceneMgr.RootSceneNode.AddChild(shieldElement.GameNode);

            physObj           = new PhysObj(10, "Shield", 0.1f, 0.5f);
            physObj.SceneNode = shieldElement.GameNode;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));

            Physics.AddPhysObj(physObj);
        }
Example #23
0
        protected override void Load()
        {
            RemoveMe    = false;
            bombElement = new ModelElement(mSceneMgr, "Bomb.mesh");
            bombElement.GameNode.Scale(2, 2, 2);
            mSceneMgr.RootSceneNode.AddChild(bombElement.GameNode);

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

            Physics.AddPhysObj(physObj);
        }
Example #24
0
        /// <summary>
        // The colour material is attached to the gem mesh. The model is positioned randomly in the scene and PhysObj attached here
        /// </summary>
        protected override void LoadModel() //The class should override the LoadModel method from Gem
        {
            base.LoadModel();               //you first call the LoadModel from the base class, base.LoadModel()
            gemEntity = mSceneMgr.CreateEntity("Gem.mesh");
            gemEntity.SetMaterialName("blue");


            gemNode = mSceneMgr.CreateSceneNode();
            gemNode.Scale(new Vector3(4f, 4f, 4f));
            gemNode.SetPosition(Mogre.Math.RangeRandom(-450, 450), 150, Mogre.Math.RangeRandom(-450, 450));
            gemNode.AttachObject(gemEntity);
            mSceneMgr.RootSceneNode.AddChild(gemNode);

            gemEntity.GetMesh().BuildEdgeList();

            physObj           = new PhysObj(11f, "Gem", 1f, 0.3f, 1f);
            physObj.SceneNode = gemNode;
            physObj.Position  = gemNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
Example #25
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"); //make sure the mesh is in the Media/models folder
            robotNode   = mSceneMgr.CreateSceneNode();
            robotNode.AttachObject(robotEntity);
            robotNode.Position = position;
            mSceneMgr.RootSceneNode.AddChild(robotNode);

            physObj           = new PhysObj(10, "Robot", 0.01f, 0.5f);
            physObj.SceneNode = robotNode;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));

            Physics.AddPhysObj(physObj);
        }
Example #26
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);
        }
Example #27
0
        protected override void Load()
        {
            projectileEntity = mSceneMgr.CreateEntity("Bomb.mesh");
            projectileNode   = mSceneMgr.CreateSceneNode();
            projectileNode.AttachObject(projectileEntity);

            gameNode = projectileNode;
            mSceneMgr.RootSceneNode.AddChild(projectileNode);
            physObj           = new PhysObj(10, "CannonBall", 1.5f, 0.5f);
            physObj.SceneNode = projectileNode;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));

            Physics.AddPhysObj(physObj);
        }
Example #28
0
        /// <summary>
        /// Contains the parts of the model and gives the model physics.
        /// </summary>
        protected void LoadModelElement()
        {
            removeMe = false;

            shieldPuModel = new ModelElement(mSceneMgr, "Sphere.Mesh");

            gameNode.Scale(1, 1, 1);

            physObj           = new PhysObj(10, "Shield", 0.1f, 0.01f, 0.5f);
            physObj.SceneNode = gameNode;

            physObj.AddForceToList(new WeightForce(physObj.InvMass));

            Physics.AddPhysObj(physObj);
        }
Example #29
0
        /// <summary>
        /// Contains the parts of the model and gives it physics.
        /// </summary>
        virtual protected void LoadModelElement()
        {
            removeMe     = false;
            blueGemModel = new ModelElement(mSceneMgr, "Gem.mesh");

            gameNode.Scale(2, 2, 2);

            physObj           = new PhysObj(15, "Gem", 0.1f, 0.01f, 0.3f);
            physObj.SceneNode = gameNode;


            physObj.AddForceToList(new WeightForce(physObj.InvMass));

            Physics.AddPhysObj(physObj);
        }
Example #30
0
        protected override void LoadModel()
        {
            RemoveMe   = false;
            gameEntity = mSceneMgr.CreateEntity("ogrehead.mesh");

            GameNode = mSceneMgr.CreateSceneNode();
            GameNode.AttachObject(gameEntity);
            mSceneMgr.RootSceneNode.AddChild(GameNode);

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

            Physics.AddPhysObj(physObj);
        }