Torque Game Engine DocumentationVersion 1.3.x |
We continue our study of datablocks which derive directly from SimDataBlock by examining the final vehicle-related datablocks in the Torque Game Engine, WheeledVehicleTire and WheeledVehicleSpring. Even though these datablocks are used in Torque's vehicle system, the datablocks themselves are simple enough that they do not need to be derived from ShapeBaseData, or even GameBaseData.
We first study the WheeledVehicleTire datablock. As its name implies, this datablock is intended to encapsulate data corresponding to vehicle tires. In the physics of wheeled vehicles, tires play an important role and Torque seeks to model their role in vehicle behavior as well as is possible in real-time. The table below offers a detailed description of each field in the WheeledVehicleTire datablock definition.
Table D.20. WheeledVehicleTire Member Fields
| Field Name | Type | Default Value | Description |
|---|---|---|---|
| shapeFile | Filename | The path and file name of a shape file to be used for the wheel. Must adhere to the semantics associated with the Filename datatype, as defined in the engine. | |
| radius | Float | 0.6 | The tire's radius. The radius is determined from the boundix box of the shape provided in the shapefile field, and does not need to be specified in script. The tire should be built with it's hub axis along the object's Y-axis. |
| mass | Float | The mass of the entire wheel. Used in the physics simulation, see the documentation for the WheeledVehicleData datablock for more information. The wheel's mass does not need to be specified in script. | |
| staticFriction | Float | 1.0 | Used in the physical simulation to represent the tire's surface friction when it is not slipping (has traction). |
| kineticFriction | Float | 0.5 | Used in the physical simulation to represent the tire's surface friction when it is slipping (has no traction). |
| lateralForce | Float | 10.0 | Used in the physical simulation to represent the tire's lateral force. Lateral force can in simple terms be considered left/right steering force. WheeledVehicles are acted upon by forces generated by their tires and the lateralForce measures the magnitude of the force exerted on the vehicle when the tires are deformed along the x-axis. With real wheeled vehicles, tires are constantly being deformed and it is the interplay of deformation forces which determines how a vehicle moves. In Torque's simulation of vehicle physics, tire deformation obviously can't be handled with absolute realism, but the interplay of a vehicle's velocity, its engine's torque and braking forces, and its wheels' friction, lateral deformation, lateralDamping, lateralRelaxation, longitudinal deformation, longitudinalDamping, and longitudinalRelaxation forces, along with its wheels' angular velocity are combined to create a robust real-time physical simulation. For this field, the larger the value supplied for the lateralForce, the larger the effect steering moves can have. In Torque tire forces are applied at a vehicle's wheel hubs. |
| lateralDamping | Float | 1.0 | Measures the dampening force applied against lateral forces generated by the tire. See the lateralForce field documentation for more information on vehicle physics as they relate to wheel forces. |
| lateralRelaxation | Float | 1.0 | Measures the relaxing force applied against lateral forces generated by the tire. The lateralRelaxation force measures how strongly the tire effectively un-deforms. See the lateralForce field documentation for more information on vehicle physics as they relate to wheel forces. |
| longitudinalForce | Float | 10.0 | Used in the physical simulation to represent the tire's longitudinal force. Longitudinal force can in simple terms be considered forward/backward movement force. WheeledVehicles are acted upon by forces generated by their tires and the longitudinalForce measures the magnitude of the force exerted on the vehicle when the tires are deformed along the y-axis. See the lateralForce field documentation for more information on wheeled vehicle physics. For this field, the larger the value supplied for the longitudinalForce, the larger the effect acceleration/deceleration moves can have. |
| longitudinalDamping | Float | 1.0 | Measures the dampening force applied against longitudinal forces generated by the tire. See the longitudinalForce field documentation for more information on longitudinal tire forces, and the laterForce field documentation for more information on general vehicle physics as they relate to wheel forces. |
| lateralRelaxation | Float | 1.0 | Measures the relaxing force applied against longitudinal forces generated by the tire. The longitudinalRelaxation force measures how strongly the tire effectively un-deforms. See the longitudinalForce field documentation for more information on longitudinal tire forces, and the laterForce field documentation for more information on general vehicle physics as they relate to wheel forces. |
| restitution | Float | 1.0 | Note: this field currently has no tangible effect in the engine's simulation. |
Since we now have a reference for the WheeledVehicleTire datablock, the final vehicle-related datablock to study is the WheeledVehicleSpring. WheeledVehicleSprings simulate the effect of a vehicle's suspension system.
Table D.21. WheeledVehicleSpring Member Fields
| Field Name | Type | Default Value | Description |
|---|---|---|---|
| force | Float | 10.0 | The force of the spring. Spring forces act straight up and are applied at the spring's root position, which is defined in the vehicle's shape. |
| length | Float | 1.0 | The length of suspension travel from the root position. |
| Damping | Float | 1.0 | Dampening force which counter-acts the spring's force. |
| antiSwayForce | Float | 1.0 | Force which acts to dampen lateral sway introduced when wheels opposite eachother are extended at different lengths. |
The physics of wheeled vehicles, their tires, and suspension systems can be difficult to understand. You shouldn't feel daunted if the nuanced manner in which all the fields we just examined interact with eachother doesn't immediately make perfect sense. The field descriptions offered in the above tables, and in the WheeledVehicleData datablock documentation, describe at a relatively high-level how wheeled vehicle physics are simulated in Torque and what the wheeled vehicle-related datablock fields are used for. But you should not expect to be a master of Torque's complex wheeled vehicle physics system after simply reading this datablock reference material.
In the next section we get closer to finishing up this reference on datablocks, as we continue with DecalData, which is another direct derivative of SimDatablock.