Example #1
0
 public override void Update()
 {
     mesh.SetPosition(Position.X, Position.Y, Position.Z);
     mesh.SetRotation(Rotation.X, Rotation.Y, Rotation.Z);
     mesh.SetScale(Scale.X, Scale.Y, Scale.Z);
     mesh.SetColor(core.Globals.RGBA(Color.R / 255f, Color.G / 255f, Color.B / 255f, 1));
 }
Example #2
0
 public override void Update()
 {
     mesh.SetPosition(Position.X, Position.Y, Position.Z);
     particle.SetGlobalPosition(Position.X, Position.Y, Position.Z);
     particle.SetGlobalRotation(Rotation.X, Rotation.Y, Rotation.Z);
     particle.SetGlobalScale(Scale.X, Scale.Y, Scale.Z);
     particle.Enable(Visible);
 }
Example #3
0
 public override void Update()
 {
     mesh.SetPosition(Position.X, Position.Y, Position.Z);
     Core.LightEngine.SetLightPosition(LightId, Position.X, Position.Y, Position.Z);
     Core.LightEngine.SetLightRange(LightId, Radius);
     Core.LightEngine.SetLightColor(LightId, this.Color.R / 255f, this.Color.G / 255f, this.Color.B / 255f);
     Core.LightEngine.EnableLight(LightId, Visible);
 }
Example #4
0
 public override void Update()
 {
     mesh.SetPosition(Position.X, Position.Y, Position.Z);
     Direction = GetDirection();
     Core.LightEngine.SetLightDirection(LightId, Direction.X, Direction.Y, Direction.Z);
     Core.LightEngine.SetLightColor(LightId, Color.R / 255f, this.Color.G / 255f, this.Color.B / 255f);
     Core.LightEngine.EnableLight(LightId, Visible);
 }
Example #5
0
        /// <summary>
        /// Moves the model
        /// </summary>
        /// <param name="movement">The amount to move (relative)</param>
        /// <returns>Indicates whether the move was successful</returns>
        public bool Move(Vector3D movement)
        {
            // Calculate new absolute vector:
            Vector3D newPosition = _position + movement;

            _position = newPosition;
            _mesh.SetPosition(_position.X - _offset.X, _position.Y - _offset.Y, _position.Z - _offset.Z);
            return(true);
        }
Example #6
0
 public override void Update()
 {
     mesh.SetPosition(Position.X, Position.Y, Position.Z);
     mySound.Position = new Vector3D(Position.X, Position.Y, Position.Z);
     mySound.Stopped = Stopped;
     mySound.Loop = Loop;
     mySound.Is3D = Is3D;
     mySound.Volume = (float)volume / 100;
     Core.SoundFactory.Update(mySound);
 }
Example #7
0
        public override void Update()
        {
            land.SetPosition(Position.X, Position.Y, Position.Z);
            land.SetRotation(Rotation.X, Rotation.Y, Rotation.Z);
            land.SetScale(Scale.X, Scale.Y, Scale.Z);

            mesh.SetPosition(Position.X, Position.Y, Position.Z);
            mesh.SetRotation(Rotation.X, Rotation.Y, Rotation.Z);
            mesh.SetScale(Scale.X, Scale.Y, Scale.Z);
        }
Example #8
0
        /// <summary>
        /// Moves the model
        /// </summary>
        /// <param name="movement">The amount to move (relative)</param>
        /// <returns>Indicates whether the move was successful</returns>
        public bool Move(Vector3D movement)
        {
            // Calculate new absolute vector:
            Vector3D newPosition = _position + movement;

            _position = newPosition;
            _mesh.SetPosition(newPosition.X, newPosition.Y, newPosition.Z);
            // TODO: Implement success
            return(true);
        }
Example #9
0
        //Add a mesh to a tile
        public void AddMeshToTile(WorldPosition Position, TVMesh Mesh)
        {
            int tilei = Position.TileX - WorldPos.TileX + RenderedTilesDistance;
            int tilej = Position.TileX - WorldPos.TileX + RenderedTilesDistance;

            if ((tilei >= 0) && (tilei <= 2 * RenderedTilesDistance) && (tilej >= 0) && (tilej <= 2 * RenderedTilesDistance))
            {
                Mesh.SetPosition(Position.TileX * MapTile.TileSize * 256 + Position.TilePosX, Position.TilePosY, Position.TileZ * MapTile.TileSize * 256 + Position.TilePosZ);
                MapTiles[tilei][tilej].Meshes.Add(Mesh);
            }
        }
Example #10
0
        public override void Initialize()
        {
            ReflectRS = Scene.CreateRenderSurfaceEx(-1, -1, CONST_TV_RENDERSURFACEFORMAT.TV_TEXTUREFORMAT_DEFAULT, true, true, 1);
            ReflectRS.SetBackgroundColor(Globals.RGBA(0f, 0f, 0.1906f, 1f));

            RefractRS = Scene.CreateRenderSurfaceEx(-1, -1, CONST_TV_RENDERSURFACEFORMAT.TV_TEXTUREFORMAT_DEFAULT, true, true, 1);
            RefractRS.SetBackgroundColor(Globals.RGBA(0f, 0f, 0.1906f, 1f));

            mesh = Core.Scene.CreateMeshBuilder();
            mesh.AddFloor(Helpers.GetDUDVTextureFromResource(Core, Resources.water), -256, -256, 256, 256, -3, 2, 2);
            mesh.SetPosition(Position.x, Position.y, Position.z);
            mesh.SetScale(Scale.x, Scale.y, Scale.z);

            plane = new TV_PLANE(Globals.Vector3(0, 1, 0), 3f);
            GraphicEffect.SetWaterReflection(mesh, ReflectRS, RefractRS, 0, plane);
        }
Example #11
0
        public override void Initialize()
        {
            ReflectRS = Scene.CreateRenderSurfaceEx(-1, -1, CONST_TV_RENDERSURFACEFORMAT.TV_TEXTUREFORMAT_DEFAULT, true, true, 1);
            ReflectRS.SetBackgroundColor(Globals.RGBA(0f, 0f, 0.1906f, 1f));

            RefractRS = Scene.CreateRenderSurfaceEx(-1, -1, CONST_TV_RENDERSURFACEFORMAT.TV_TEXTUREFORMAT_DEFAULT, true, true, 1);
            RefractRS.SetBackgroundColor(Globals.RGBA(0f, 0f, 0.1906f, 1f));

            mesh = Core.Scene.CreateMeshBuilder();
            mesh.AddFloor(Helpers.GetDUDVTextureFromResource(Core, Resources.water), -256, -256, 256, 256, -3, 2, 2);
            mesh.SetPosition(Position.x, Position.y, Position.z);
            mesh.SetScale(Scale.x, Scale.y, Scale.z);

            plane = new TV_PLANE(Globals.Vector3(0, 1, 0), 3f);
            GraphicEffect.SetWaterReflection(mesh, ReflectRS, RefractRS, 0, plane);
        }
Example #12
0
        public void RotateZAroundPoint(TV_3DVECTOR point, float angle)
        {
            TVMesh node = Scene.CreateMeshBuilder();

            node.SetPosition(point.x, point.y, point.z);
            mesh.AttachTo(CONST_TV_NODETYPE.TV_NODETYPE_MESH, node.GetIndex(), -1);
            TV_3DVECTOR nodePos = node.GetPosition();
            TV_3DMATRIX mat     = new TV_3DMATRIX();
            TV_3DMATRIX modyMat = node.GetMatrix();

            MathLibrary.TVMatrixRotationZ(ref mat, angle);
            node.SetRotationMatrix(mat);
            mesh.AttachTo(CONST_TV_NODETYPE.TV_NODETYPE_NONE, -1, -1);
            node.Destroy();
            mat = mesh.GetMatrix();
            Physics.SetBodyMatrix(PhysicsId, mat);
        }
Example #13
0
        public override void Initialize()
        {
            mesh = Scene.CreateMeshBuilder();

            switch (Helpers.GetFileFormat(FileName))
            {
            case Helpers.FileFormat.TVM:
                mesh.LoadTVM(FileName, true, false);
                break;

            case Helpers.FileFormat.X:
                mesh.LoadXFile(FileName, true, false);
                break;
            }

            if (Visible)
            {
                mesh.EnableFrustumCulling(true, true);
                mesh.ComputeNormals();
                mesh.ComputeBoundings();
                mesh.ComputeOctree();
                mesh.SetAlphaTest(true);
                mesh.SetCullMode(CONST_TV_CULLING.TV_BACK_CULL);
                mesh.SetBlendingMode(CONST_TV_BLENDINGMODE.TV_BLEND_ALPHA);
                mesh.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED);
                mesh.SetShadowCast(true, true);

                mesh.SetPosition(Position.x, Position.y, Position.z);
                mesh.SetRotation(Rotation.x, Rotation.y, Rotation.z);
                mesh.SetScale(Scale.x, Scale.y, Scale.z);

                // Physics
                SetPhysics();
            }
            else
            {
                // Hide mesh.
                for (var i = 0; i < mesh.GetGroupCount(); i++)
                {
                    mesh.SetGroupEnable(i, false);
                }
            }

            // Register object in Lua.
            ScriptManager.SetGlobal(Name, this);
        }
Example #14
0
        public override void Initialize()
        {
#if DEBUG
            Show = true;
#endif
            TVMesh mesh = Scene.CreateMeshBuilder(Name);
            mesh.CreateBox(1, 1, 1);
            mesh.SetPosition(Position.x, Position.y, Position.z);
            mesh.SetRotation(Rotation.x, Rotation.y, Rotation.z);
            mesh.SetScale(Scale.x, Scale.y, Scale.z);
            mesh.GetBoundingBox(ref boundingBoxMin, ref boundingBoxMax);
            mesh.Destroy();
            mesh = null;

            // Register object in Lua.
            ScriptManager.SetGlobal(Name, this);
        }
Example #15
0
File: Mesh.cs Project: zulis/Cubica
        public override void Initialize()
        {
            mesh = Scene.CreateMeshBuilder();

            switch (Helpers.GetFileFormat(FileName))
            {
                case Helpers.FileFormat.TVM:
                    mesh.LoadTVM(FileName, true, false);
                    break;
                case Helpers.FileFormat.X:
                    mesh.LoadXFile(FileName, true, false);
                    break;
            }

            if (Visible)
            {
                mesh.EnableFrustumCulling(true, true);
                mesh.ComputeNormals();
                mesh.ComputeBoundings();
                mesh.ComputeOctree();
                mesh.SetAlphaTest(true);
                mesh.SetCullMode(CONST_TV_CULLING.TV_BACK_CULL);
                mesh.SetBlendingMode(CONST_TV_BLENDINGMODE.TV_BLEND_ALPHA);
                mesh.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED);
                mesh.SetShadowCast(true, true);

                mesh.SetPosition(Position.x, Position.y, Position.z);
                mesh.SetRotation(Rotation.x, Rotation.y, Rotation.z);
                mesh.SetScale(Scale.x, Scale.y, Scale.z);

                // Physics
                SetPhysics();
            }
            else
            {
                // Hide mesh.
                for (var i = 0; i < mesh.GetGroupCount(); i++)
                    mesh.SetGroupEnable(i, false);
            }

            // Register object in Lua.
            ScriptManager.SetGlobal(Name, this);
        }
Example #16
0
        //Inicializace a vytvoreni mistnosti
        private void VyvorMistnost()
        {
            //Inicializace mistnosti
            Room = Scene.CreateMeshBuilder("RoomMesh");

            //Nacteni textur
            VytvorTextury();

            //Pridani sten a nastaveni pozice mistnosti
            Room.AddWall3D(Globals.GetTex("Wall"), 150.0f, -350.0f, -350.0f, -350.0f, 350.0f, 5.0f, false, false, -50.0f, 5.0f, 5.0f);
            Room.AddWall3D(Globals.GetTex("Wall"), -350.0f, -350.0f, -350.0f, 150.0f, 350.0f, 5.0f, false, false, -50.0f, 5.0f, 5.0f);
            Room.AddWall3D(Globals.GetTex("Wall"), -350.0f, 150.0f, 150.0f, 150.0f, 350.0f, 5.0f, false, false, -50.0f, 5.0f, 5.0f);
            Room.AddWall3D(Globals.GetTex("Wall"), 150.0f, 150.0f, 150.0f, -350.0f, 350.0f, 5.0f, false, false, -50.0f, 5.0f, 5.0f);
            Room.AddFloor(Globals.GetTex("Floor"), -350.0f, -350f, 150.0f, 150.0f, -50.0f, 20.0f, 20.0f, true);
            Room.AddFloor(Globals.GetTex("Floor"), -350.0f, -350.0f, 150.0f, 150.0f, 300.0f, 10.0f, 10.0f, true);
            Room.SetPosition((float)30.0f, (float)-30.0f, (float)150.0f);

            //Pridani stolku
            Obj1 = new TVMesh();
            Obj1 = Scene.CreateMeshBuilder("Obj1");
            Obj1.LoadXFile("Meshe\\stul.x", true, true);
            Obj1.SetPosition(-57.0f, -80.0f, 38.0f);
            Obj1.SetTexture(Globals.GetTex("Wood"), -1);
            Obj1.SetMeshName("other");

            Obj2 = new TVMesh();
            Obj2 = Scene.CreateMeshBuilder("Obj2");
            Obj2.LoadXFile("Meshe\\okraj.x", true, true);
            Obj2.SetPosition(xc + 17.5f, yc - 1.0f, zc + 17.5f);
            Obj2.SetTexture(Globals.GetTex("Wood2"), -1);
            Obj2.SetMeshName("other");
        }
Example #17
0
 //Add a mesh to a tile
 public void AddMeshToTile(WorldPosition Position, TVMesh Mesh)
 {
     int tilei = Position.TileX - WorldPos.TileX + RenderedTilesDistance;
     int tilej = Position.TileX - WorldPos.TileX + RenderedTilesDistance;
     if ((tilei >= 0) && (tilei <= 2 * RenderedTilesDistance) && (tilej >= 0) && (tilej <= 2 * RenderedTilesDistance))
     {
         Mesh.SetPosition(Position.TileX * MapTile.TileSize * 256 + Position.TilePosX, Position.TilePosY, Position.TileZ * MapTile.TileSize * 256 + Position.TilePosZ);
         MapTiles[tilei][tilej].Meshes.Add(Mesh);
     }
 }
        //*** Render Method
        private void SetupScene(IntPtr hWnd)
        {
            TV_3DVECTOR Min = new TV_3DVECTOR();
            TV_3DVECTOR Max = new TV_3DVECTOR();
            TV_3DVECTOR Offset = new TV_3DVECTOR();
            TV_3DVECTOR SphereCenter = new TV_3DVECTOR();
            TV_3DVECTOR posVector = new TV_3DVECTOR();

            TV = new TVEngine();
            Scene = new TVScene();
            Cam = new TVCamera();
            TF = new TVTextureFactory();
            Mats = new TVMaterialFactory();
            Lights = new TVLightEngine();
            Maths = new TVMathLibrary();

            //Initialize the TV engine
            TV.SetDebugFile(Application.StartupPath + "\\debug.txt");
            TV.Init3DWindowed(hWnd, true);
            TV.SetSearchDirectory(Application.StartupPath);
            TV.SetAngleSystem(CONST_TV_ANGLE.TV_ANGLE_DEGREE);  // use degree system

            Scene.SetBackgroundColor(0.6f, 0.6f, 0.6f);

            //Load the texture into the integer ID holder
            FloorTex = TF.LoadTexture("smallGrid.bmp", "Grid", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true);
            WallTex = TF.LoadTexture("smallGridWall.bmp", "Wall", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true);

            Room = Scene.CreateMeshBuilder("Room");
            Room.AddFloor(FloorTex, -300.0f, -300.0f, 300.0f, 300.0f, 0, 15.0f, 15.0f, true);
            Room.AddWall(WallTex, -300.0f, 300.0f, 300.0f, 300.0f, 400.0f, 0, 15.0f, 15.0f, true);
            Room.AddWall(WallTex, 300.0f, -300.0f, -300.0f, -300.0f, 400.0f, 0, 15.0f, 15.0f, true);
            Room.AddWall(WallTex, 300.0f, 300.0f, 300.0f, -300.0f, 400.0f, 0, 15.0f, 15.0f, true);
            Room.AddWall(WallTex, -300.0f, -300.0f, -300.0f, 300.0f, 400.0f, 0, 15.0f, 15.0f, true);
            //ShowVector("RoomLocal", Room.GetPosition());
            //ShowVector("RoomWorld", Room.GetWorldPosition(Room.GetPosition()));

            SensorNode = Scene.CreateMeshBuilder("SensorNode");
            SensorNode.LoadXFile("N70.X", true, true);
            SensorNode.SetParent(CONST_TV_NODETYPE.TV_NODETYPE_MESH, Room.GetIndex(), 1);
            SensorNode.SetPosition(0.0f, 150.0f, 0.0f);
            TV_3DVECTOR oriScale = SensorNode.GetScale();
            SensorNode.SetScale(oriScale.x, oriScale.y, oriScale.z * 1.5f);
            SensorNode.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_NORMAL, 0, 1);
            SensorNode.SetRotation(90.0f, 0.0f, 0.0f);
            //SensorNode.GetBoundingBox(ref Min, ref Max, true);
            //SensorNode.ShowBoundingBox(true);
            //ShowVector("MoteLocal", SensorNode.GetPosition());
            //ShowVector("MoteWorld", Room.GetWorldPosition(SensorNode.GetPosition()));

            //WiimoteMesh = Scene.CreateMeshBuilder("Wiimote");
            //WiimoteMesh.LoadXFile("Wiimote.X", true, true);
            //TV_3DVECTOR oriScale = WiimoteMesh.GetScale();
            //WiimoteMesh.SetScale(oriScale.x * 0.15f, oriScale.y * 0.15f, oriScale.z * 0.15f);
            //WiimoteMesh.SetPosition(0.0f, 70.0f, 0.0f);
            //WiimoteMesh.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_NORMAL, 0, 1);//Tell TV we want normal, per-vertex, lighting with 1 point light.

            Cam.SetParent(CONST_TV_NODETYPE.TV_NODETYPE_MESH, Room.GetIndex(), 0);
            Cam.SetPosition(0.0f, 250.0f, 200.0f);
            Cam.LookAtMesh(SensorNode);
            //ShowVector("CamLocal", Cam.GetPosition());
            //ShowVector("CamWorld", Room.GetWorldPosition(Cam.GetPosition()));

            //Create a point light. Again, these can be more complex.
            IDLight = Lights.CreatePointLight(new TV_3DVECTOR(0.0f, 250.0f, 200.0f), 0.9f, 0.9f, 0.9f, 250.0f);
            IDBackLight = Lights.CreatePointLight(new TV_3DVECTOR(0.0f, 250.0f, -200.0f), 0.1f, 0.1f, 0.1f, 250.0f);
            Lights.SetSpecularLighting(false);
        }
Example #19
0
        private void InitObjects()
        {
            #region Car
            //Building PK9
            pk_9 = scene.CreateMeshBuilder("pk");
            // load the object from an x file
            pk_9.LoadTVM(@"Models\pk8.tvm", false, false);
            // set its position
            pk_9.SetPosition(5.0f, 0.0f, 50.0f);
            // make the table 3x larger
            pk_9.SetScale(3, 3, 3);
            // rotate it 25 degrees around the Y 3D Axis
            pk_9.RotateY(25, true);
            // set the tables texture
            pk_9.SetShadowCast(true, true);
            pk_9.SetTexture(globals.GetTex("pk9tex"), 0);

            //Chassis
            m_chassis = scene.CreateMeshBuilder("mChassis");
            m_chassis.LoadTVM(@"Models\chassis.tvm", false, false);
            m_chassis.SetShadowCast(true, true);
            m_chassis.SetTexture(globals.GetTex("ChassisSTI"), 0);
            //m_chassis.SetTextureEx(0, globals.GetTex("ChassisSTI"), 1);
            //m_chassis.SetTextureEx(1, globals.GetTex("ChassisSTI"), 1);
            m_chassis.SetTexture(globals.GetTex("UnderCarriage"), 2);
            m_chassis.SetMaterial(matWindow, 1);
            m_chassis.SetAlphaTest(true, 0, true, 1);
            m_chassis.SetBlendingMode(CONST_TV_BLENDINGMODE.TV_BLEND_ADD, 1);
            m_chassis.SetCullMode(CONST_TV_CULLING.TV_DOUBLESIDED);
            m_chassis.SetShadowCast(true, true);

            //Front Left Wheel
            float scale = 1f;
            m_fl = scene.CreateMeshBuilder("mfl");
            m_fl.LoadTVM(@"Models\wheel_l.tvm", true, true);
            m_fl.SetScale(scale, scale, scale);
            m_fl.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED);
            m_fl.SetMaterial(matWheels);
            m_fl.SetTexture(globals.GetTex("Wheel"));
            m_fl.SetCullMode(CONST_TV_CULLING.TV_DOUBLESIDED);
            m_fl.SetShadowCast(true, true);

            //Front Right Wheel
            m_rl = scene.CreateMeshBuilder("mrl");
            m_rl.LoadTVM(@"Models\wheel_l.tvm", true, true);
            m_rl.SetScale(scale, scale, scale);
            m_rl.SetMaterial(matWheels);
            m_rl.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED);
            m_rl.SetTexture(globals.GetTex("Wheel"));
            m_rl.SetCullMode(CONST_TV_CULLING.TV_DOUBLESIDED);
            m_rl.SetShadowCast(true, false);
            m_rl.SetShadowCast(true, true);

            //Rear Left Wheel
            m_fr = scene.CreateMeshBuilder("mfr");
            m_fr.LoadTVM(@"Models\wheel_r.tvm", true, true);
            m_fr.SetScale(scale, scale, scale);
            m_fr.SetMaterial(matWheels);
            m_fr.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED);
            m_fr.SetTexture(globals.GetTex("Wheel"));
            m_fr.SetCullMode(CONST_TV_CULLING.TV_DOUBLESIDED);
            m_fr.SetShadowCast(true, false);

            //Rear Right Wheel
            m_rr = scene.CreateMeshBuilder("mrr");
            m_rr.LoadTVM(@"Models\wheel_r.tvm", true, true);
            m_rr.SetScale(scale, scale, scale);
            m_rr.SetMaterial(matWheels);
            m_rr.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED);
            m_rr.SetTexture(globals.GetTex("Wheel"));
            m_rr.SetCullMode(CONST_TV_CULLING.TV_DOUBLESIDED);
            m_rr.SetShadowCast(true, false);
            m_rr.SetShadowCast(true, true);

            m_chassis.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED);
            m_chassis.SetMaterial(matVehicleBody);
            m_chassis.ComputeNormals();
            m_chassis.ComputeBoundings();
            m_chassis.SetScale(scale, scale, scale);
            #endregion

            //Add The Physics to the chassis
            pbi_chassis = physics.CreateMeshBody(1500, m_chassis, CONST_TV_PHYSICSBODY_BOUNDING.TV_BODY_CONVEXHULL); //1500
            physics.SetAutoFreeze(pbi_chassis, false);
            physics.SetBodyPosition(pbi_chassis, 0f, 15, 0f);
            physics.SetBodyRotation(pbi_chassis, 0f, 0f, 0f);

            //Create The Vehicle
            car_ID = physics.CreateVehicle(pbi_chassis);

            //Do Suspention Settings
            float susheight = 1.5f; //distance from chassis to wheel 0.5f
            float susplen = 1.5f; // 10
            float susshock = 40f; //Springiness of suspension 10
            float susspring = 300f; //Stiffness of suspension 400
            flw = physics.AddVehicleWheelEx(car_ID, 25f, 0.5f * scale, 0.372f * scale+0.1f, new TV_3DVECTOR(1, 0, 0), -0.8f * scale, -susheight * scale - 0.1f, 1.25f * scale + 0.5f, 1, 0, 0, susplen, susshock, susspring, m_fl); //fl
            frw = physics.AddVehicleWheelEx(car_ID, 25f, 0.5f * scale, 0.372f * scale+0.1f, new TV_3DVECTOR(1, 0, 0), 0.8f * scale, -susheight * scale - 0.1f, 1.25f * scale + 0.5f, 1, 0, 0, susplen, susshock, susspring, m_fr); //fr
            rlw = physics.AddVehicleWheelEx(car_ID, 25f, 0.5f * scale, 0.372f * scale+0.1f, new TV_3DVECTOR(1, 0, 0), -0.8f * scale, -susheight * scale - 0.1f, -1.425f * scale + 0.2f, 1, 0, 0, susplen, susshock, susspring, m_rl); //rl
            rrw = physics.AddVehicleWheelEx(car_ID, 25f, 0.5f * scale, 0.372f * scale+0.1f, new TV_3DVECTOR(1, 0, 0), 0.8f * scale, -susheight * scale - 0.1f, -1.425f * scale + 0.2f, 1, 0, 0, susplen, susshock, susspring, m_rr); //rr

            //Change the car's center of mass / make it drive better
            physics.SetBodyCenterOfMass(car_ID, new TV_3DVECTOR(0, -1.0f, 10f));

            //Add wheel frictions
            //Note that this code will also stop sliding on slopes
            float sideslip = 0.1f;
            float sideslipcoef = 0f;
            float maxlongslide = 10000f;
            float maxlongslidecoef = 0f;
            physics.SetVehicleWheelParameters(car_ID, flw, sideslip, sideslipcoef, maxlongslide, maxlongslidecoef);
            physics.SetVehicleWheelParameters(car_ID, frw, sideslip, sideslipcoef, maxlongslide, maxlongslidecoef);
            physics.SetVehicleWheelParameters(car_ID, rlw, sideslip, sideslipcoef, maxlongslide, maxlongslidecoef);
            physics.SetVehicleWheelParameters(car_ID, rrw, sideslip, sideslipcoef, maxlongslide, maxlongslidecoef);
        }