TorqueScript/Datablocks/VehicleData
From TDN
[edit]
VehicleData
VehicleData derives from ShapeBaseData and aids the creation of vehicle objects. Several other datablocks, such as WheeledVehicleData and FlyingVehicleData, derive from VehicleData. VehicleData defines many new fields, which are listed in the table below.
| Field Name | Type | Default Value | Description |
|---|---|---|---|
| Special Effects Data | |||
| softImpactSound | AudioProfilePtr | NULL | The AudioProfile used to produce sounds for soft impacts. If specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. |
| hardImpactSound | AudioProfilePtr | NULL | The AudioProfile used to produce sounds for hard impacts. If specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. |
| splashFreqMod | Float | 300.0 | The simulated frequency modulation of a splash generated by this vehicle. Multiplied along with vehicle speed and time elapsed when determining splash emition rate. |
| splashVelEpsilon | Float | 0.5 | The threshold speed at which we consider the vehicle's movement to have stopped when updating splash effects. |
| splashEmitter | ParticleEmitterDataPtr (array) | NULL |
Array of pointers to ParticleEmitterData datablocks which will generate splash effects. If specified, each pointer must reference a datablock of type ParticleEmitterData. Must adhere to the semantics associated with ParticleEmitterData*, as defined in the Torque Game Engine. |
| exitSplashSoundVelocity | Float | 2.0 | The minimum velocity at which the exit splash sound will be played when emerging from water. |
| softSplashSoundVelocity | Float | 1.0 | The minimum velocity at which the soft splash sound will be played when impacting water. |
| mediumSplashSoundVelocity | Float | 2.0 | The minimum velocity at which the medium splash sound will be played when impacting water. |
| hardSplashSoundVelocity | Float | 3.0 | The minimum velocity at which the hard splash sound will be played when impacting water. |
| exitingWater | AudioProfilePtr | NULL | The AudioProfile will be used to produce sounds when emerging from water. If specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. |
| impactWaterEasy | AudioProfilePtr | NULL | The AudioProfile will be used to produce sounds when a soft impact with water occurs. If specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. |
| impactWaterMedium | AudioProfilePtr | NULL | The AudioProfile will be used to produce sounds when a medium impact with water occurs. If specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. |
| impactWaterHard | AudioProfilePtr | NULL | The AudioProfile will be used to produce sounds when a hard impact with water occurs. If specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. |
| waterWakeSound | AudioProfilePtr | NULL | The AudioProfile will be used to produce sounds when a water wake is displayed. If specified, must point to an object of type AudioProfile. Must adhere to the semantics associated with AudioProfile*, as defined in the Torque Game Engine. |
| triggerDustHeight | Float | 3.0 | Maximum height from the ground at which the vehicle will generate dust. |
| dustHeight | Float | 1.0 | Height of dust effects. |
| dustEmitter | ParticleEmitterDataPtr (array) | NULL |
Array of pointers to ParticleEmitterData datablocks which will be used to emit particles at vehicle/terrain contact point. If specified, must point to a datablock of type ParticleEmitterData. Must adhere to the semantics associated with ParticleEmitterData*, as defined in the Torque Game Engine. |
| damageEmitterOffset | Point3F (array) | (uninitialized) [VC_NUM_DAMAGE_EMITTER_AREAS] |
Offset point at which to display damage effects. The number of array entries is limited by the VC_NUM_DAMAGEEMITTER_AREAS constant within the VehicleConsts enumeration as specified in the VehicleData class definition withing the Torque Game Engine. |
| numDmgEmitterAreas | Float | 0.0 | The number of areas on the vehicle that can display damage effects. |
| damageEmitter | ParticleEmitterDataPtr (array) | NULL [VC_NUM_DAMAGE_EMITTERS] |
Array of pointers to ParticleEmitterData datablocks which will be used to emit particles for damage effects (smoke). If specified, the pointers must point to a datablock of type ParticleEmitterData. Must adhere to the semantics associated with ParticleEmitterData*, as defined in the Torque Game Engine. |
| Camera Data | |||
| cameraRoll | Boolean | True | Specifies whether the camera's rotation matrix, and the render eye transform are multiplied during camera updates. |
| cameraLag | Float | 0.0 | Scalar amount by which the third person camera lags the vehicle, relative to the vehicle's linear velocity. |
| cameraDecay | Float | 0.0 | Scalar rate at which the third person camera offset decays, per tick. |
| cameraOffset | Float | 0.0 | The vertical offset of the vehicle's camera. |
| Physics Data | |||
| integration | Integer | 1 | The number of discrete steps with which to process physics data per tick. |
| minImpactSpeed | Float | 25.0 | Minimum speed at which the vehicle must be travelling for the OnImpact script function to be called. |
| softImpactSpeed | Float | 25.0 | Minimum speed at which the vehicle must be travelling for the soft impact sound to be played. |
| hardImpactSpeed | Float | 50.0 | Minimum speed at which the vehicle must be travelling for the hard impact sound to be played. |
| massCenter | Point3F | (0.0, 0.0, 0.0) | The vehicle's rigid body center of mass. |
| bodyRestitution | Float | 1.0 | The vehicle's rigid body restitution. Used in the physical simulation during collisions. The scalar restitution value affects the strength of the body's rebound resulting from collisions with objects. Higher restitution values yield more powerful rebound reactions. |
| bodyFriction | Float | 0.0 | The vehicle's rigid body friction coefficient. Used in the physical simulation during contacts and collisions. Higher friction values dampen contact and collision forces. |
| contactTol | Float | 0.1 | The minimum collision velocity required to trigger a collision contact. Collisions with velocities less than the contactTol value will be treated as collision constraints. |
| collisionTol | Float | 0.1 | The minimum collision velocity required to trigger a full collision. Collisions with velocities less than the collisionTol value will be treated as collision contacts or constraints. |
| damageLevelTolerance | Float (array) | 0.0 [VC_NUM_DAMAGE_LEVELS] |
Array of floats specifying damage level thresholds. Each entry is specified as a decimal percentage of maxDamage (defined in ShapeBaseData). Each damage level is used to determine what damage effect to play. |
| maxSteeringAngle | Float | 0.785 | Maximum attainable steering angle, measured in radians. Steering angles are clamped to this maximum value. |
| minDrag | Float | 0.0 | The minimum drag acting on the vehicle at all times. At present, this field is only used by FlyingVehicleData and helps determine it's maxSpeed and movement force. |
| maxDrag | Float | 0.0 | Intended to clamp the maximum drag available. Note: this field currently has no tangible effect in the engine's simulation.. |
| jetForce | Float | 500.0 | Force generated by the vehicle's jet, if it has one. This field is only used by derived classes. |
| jetEnergyDrain | Float | 0.8 | Energy drained per tick by use of the vehicle's jet, if it has one. |
| minJetEnergy | Float | 1.0 | Minimum energy required in order to use the vehicle's jet, if it has one.. |
| collDamageThresholdVel | Float | 20.0 | Note: this field currently has no tangible effect in the engine's simulation.. |
| collDamageMultiplier | Float | 0.05 | Note: this field currently has no tangible effect in the engine's simulation.. |
| minRollSpeed | Float | 0.0 | Note: this field currently has no tangible effect in the engine's simulation.. |
[edit]
Full Example Script
The current content is a copy of the data above, although a little re-aranged to make it more grouped. Please revise this before you use it for your vehicle.
datablock VehicleData(MyCar)
{
className = Vehicles;
shapeFile = "~/data/shapes/vehicles/mycar.dts";
emap = true;
splashFreqMod = 300.0;
splashVelEpsilon = 0.5;
splashEmitter = ParticleEmitterData;
// Audio Details
exitSplashSoundVelocity = 2.0;
softSplashSoundVelocity = 1.0;
mediumSplashSoundVelocity = 2.0;
hardSplashSoundVelocity = 3.0;
// Audio Data
softImpactSound = NULL;
hardImpactSound = NULL;
exitingWater = NULL;
impactWaterEasy = NULL;
impactWaterMedium = NULL;
impactWaterHard = NULL;
waterWakeSound = NULL;
// Dust Emitter Details
triggerDustHeight = 3.0;
dustHeight = 1.0;
dustEmitter = ParticleEmitterData;
// Damage Details
numDmgEmitterAreas = 0.0;
damageEmitter = ParticleEmitterData;
damageEmitterOffset[0] = "1.0 1.0 1.0";
damageEmitterOffset[1] = "1.0 1.0 1.0";
damageEmitterOffset[2] = "1.0 1.0 1.0";
//etc..
// Camera Details
cameraRoll = true;
cameraLag = 0.0;
cameraDecay = 0.0;
cameraOffset = 0.0;
//Physics Data
integration = 1; // The number of discrete steps with which to process physics data per tick.
minImpactSpeed = 25.0;
softImpactSpeed = 25.0;
hardImpactSpeed = 50.0;
massCenter = "0.0 0.0 0.0";
bodyRestitution = 1.0;
bodyFriction = 0.0;
contactTol = 0.1;
collisionTol = 0.1;
damageLevelTolerance = 0.0;
maxSteeringAngle = 0.785;
minDrag = 0.0;
maxDrag = 0.0;
jetForce = 500.0;
jetEnergyDrain = 0.8;
minJetEnergy = 1.0;
// Note: These fields currently has no tangible effect in the engine's simulation..
collDamageThresholdVel = 20.0;
collDamageMultiplier = 0.05;
minRollSpeed = 0.0;
}



