Ejemplo n.º 1
0
        public void CreatePlane()
        {
            var planeNode = CreateChild("MainPlane");

            planeNode.Scale = new Vector3(30, 1, 30);

            ScenePlane = planeNode.CreateComponent <StaticModel>();

            ScenePlane.Model = MainApplication.ResourceCache.GetModel("Models/Plane.mdl");

            ScenePlane.SetMaterial(MainApplication.ResourceCache.GetMaterial("Materials/StoneTiled.xml"));

            //give it a rigidbody
            RigidBody planeRigidBody = planeNode.CreateComponent <RigidBody>();

            planeRigidBody.Mass       = 0; //a mass of zero means it is a static entity
            planeRigidBody.UseGravity = false;

            //Make a collision box around the plane
            CollisionShape planeCollisionShape = planeNode.CreateComponent <CollisionShape>();

            planeCollisionShape.Size = new Vector3(30, 1, 30);

            DebugRenderer renderer = GetComponent <DebugRenderer>();

            if (renderer != null)
            {
                ScenePlane.DrawDebugGeometry(renderer, true);
            }
        }
Ejemplo n.º 2
0
        public void CreatePlane(
            string materialName,
            Mogre.Vector3 rkNormals,
            float consts,
            int width,
            int height,
            int xsegements,
            int ysegements,
            ushort numTexCoords,
            int uTile,
            int vTile,
            Mogre.Vector3 upVector,
            Mogre.Vector3 initPosition)
        {
            ScenePlane plane = new ScenePlane(gameObjects.Count, world, rkNormals, consts, materialName, ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                                              width, height, xsegements, ysegements, true, numTexCoords, uTile, vTile, upVector, initPosition);

            if (!gameObjects.ContainsKey("PLANE"))
            {
                gameObjects.Add("PLANE", new List <GameObject>());
            }
            gameObjects["PLANE"].Add(plane);
        }