VehicleData¶
Base properties shared by all Vehicles (FlyingVehicle, HoverVehicle, WheeledVehicle).
- Inherit:
- ShapeBaseData
Description¶
This datablock defines properties shared by all Vehicle types, but should not be instantiated directly. Instead, set the desired properties in the FlyingVehicleData, HoverVehicleData or WheeledVehicleData datablock.
Damage¶
The VehicleData class extends the basic energy/damage functionality provided by ShapeBaseData to include damage from collisions, as well as particle emitters activated automatically when damage levels reach user specified thresholds.
The example below shows how to setup a Vehicle to:
Example:
// damage from collisionscollDamageMultiplier = 0.05;
collDamageThresholdVel = 15;
// damage levelsdamageLevelTolerance[0] = 0.5;
damageEmitter[0] = GraySmokeEmitter; // emitter used when damage is >= 50%
damageLevelTolerance[1] = 0.85;
damageEmitter[1] = BlackSmokeEmitter; // emitter used when damage is >= 85%
damageEmitter[2] = DamageBubbleEmitter; // emitter used instead of damageEmitter[0:1]
// when offset point is underwater
// emit offsets (used for all active damage level emitters)
damageEmitterOffset[0] = "0.5 3 1";
damageEmitterOffset[1] = "-0.5 3 1";
numDmgEmitterAreas = 2;
Methods¶
-
void
VehicleData
::
onEnterLiquid
(Vehicle obj, float coverage, string type)¶ Called when the vehicle enters liquid.
Parameters: - obj – the Vehicle object
- coverage – percentage of the vehicle’s bounding box covered by the liquid
- type – type of liquid the vehicle has entered
-
void
VehicleData
::
onLeaveLiquid
(Vehicle obj, string type)¶ Called when the vehicle leaves liquid.
Parameters: - obj – the Vehicle object
- type – type of liquid the vehicle has left
Fields¶
-
float
VehicleData
::
bodyFriction
¶ Collision friction coefficient. How well this object will slide against objects it collides with.
-
float
VehicleData
::
bodyRestitution
¶ Collision ‘bounciness’. Normally in the range 0 (not bouncy at all) to 1 (100% bounciness).
-
float
VehicleData
::
cameraDecay
¶ How quickly the camera moves back towards the vehicle when stopped.
-
float
VehicleData
::
cameraLag
¶ How much the camera lags behind the vehicle depending on vehicle speed. Increasing this value will make the camera fall further behind the vehicle as it accelerates away.
-
float
VehicleData
::
cameraOffset
¶ Vertical (Z axis) height of the camera above the vehicle.
-
bool
VehicleData
::
cameraRoll
¶ If true, the camera will roll with the vehicle. If false, the camera will always have the positive Z axis as up.
-
float
VehicleData
::
collDamageMultiplier
¶ Damage to this vehicle after a collision (multiplied by collision velocity). Currently unused.
-
float
VehicleData
::
collDamageThresholdVel
¶ Minimum collision velocity to cause damage to this vehicle. Currently unused.
-
float
VehicleData
::
collisionTol
¶ Minimum distance between objects for them to be considered as colliding.
-
float
VehicleData
::
contactTol
¶ Maximum relative velocity between objects for collisions to be resolved as contacts. Velocities greater than this are handled as collisions.
-
ParticleEmitterData
VehicleData
::
damageEmitter
[3]¶ Array of particle emitters used to generate damage (dust, smoke etc) effects. Currently, the first two emitters (indices 0 and 1) are used when the damage level exceeds the associated damageLevelTolerance. The 3rd emitter is used when the emitter point is underwater.
-
Point3F
VehicleData
::
damageEmitterOffset
[2]¶ Object space “x y z” offsets used to emit particles for the active damageEmitter.
Example:
// damage levelsdamageLevelTolerance[0] = 0.5; damageEmitter[0] = SmokeEmitter; // emit offsets (used for all active damage level emitters) damageEmitterOffset[0] = "0.5 3 1"; damageEmitterOffset[1] = "-0.5 3 1"; numDmgEmitterAreas = 2;
-
float
VehicleData
::
damageLevelTolerance
[2]¶ Damage levels (as a percentage of maxDamage) above which to begin emitting particles from the associated damageEmitter. Levels should be in order of increasing damage.
-
ParticleEmitterData
VehicleData
::
dustEmitter
¶ Dust particle emitter.
-
float
VehicleData
::
dustHeight
¶ Height above ground at which to emit particles from the dustEmitter.
-
SFXProfile
VehicleData
::
exitingWater
¶ Sound to play when exiting the water.
-
float
VehicleData
::
exitSplashSoundVelocity
¶ Minimum velocity when leaving the water for the exitingWater sound to play.
-
SFXProfile
VehicleData
::
hardImpactSound
¶ Sound to play on a ‘hard’ impact. This sound is played if the impact speed gt = hardImpactSpeed.
-
float
VehicleData
::
hardImpactSpeed
¶ Minimum collision speed for the hardImpactSound to be played.
-
float
VehicleData
::
hardSplashSoundVelocity
¶ Minimum velocity when entering the water for the imapactWaterHard sound to play.
-
SFXProfile
VehicleData
::
impactWaterEasy
¶ Sound to play when entering the water with speed gt = softSplashSoundVelocity and lt mediumSplashSoundVelocity.
-
SFXProfile
VehicleData
::
impactWaterHard
¶ Sound to play when entering the water with speed gt = hardSplashSoundVelocity.
-
SFXProfile
VehicleData
::
impactWaterMedium
¶ Sound to play when entering the water with speed gt = mediumSplashSoundVelocity and lt hardSplashSoundVelocity.
-
int
VehicleData
::
integration
¶ Number of integration steps per tick. Increase this to improve simulation stability (also increases simulation processing time).
-
float
VehicleData
::
jetEnergyDrain
¶ Energy amount to drain for each tick the vehicle is jetting. Once the vehicle’s energy level reaches 0, it will no longer be able to jet.
-
float
VehicleData
::
jetForce
¶ Additional force applied to the vehicle when it is jetting. For WheeledVehicles, the force is applied in the forward direction. For FlyingVehicles, the force is applied in the thrust direction.
-
Point3F
VehicleData
::
massBox
¶ Define the box used to estimate the vehicle’s moment of inertia. Currently only used by WheeledVehicle ; other vehicle types use a unit sphere to compute inertia.
-
Point3F
VehicleData
::
massCenter
¶ Defines the vehicle’s center of mass (offset from the origin of the model).
-
float
VehicleData
::
maxDrag
¶ Maximum drag coefficient. Currently unused.
-
float
VehicleData
::
maxSteeringAngle
¶ Maximum yaw (horizontal) and pitch (vertical) steering angle in radians.
-
float
VehicleData
::
mediumSplashSoundVelocity
¶ Minimum velocity when entering the water for the imapactWaterMedium sound to play.
-
float
VehicleData
::
minDrag
¶ Minimum drag coefficient. Currently only used by FlyingVehicle .
-
float
VehicleData
::
minImpactSpeed
¶ Minimum collision speed for the onImpact callback to be invoked.
-
float
VehicleData
::
minJetEnergy
¶ Minimum vehicle energy level to begin jetting.
-
float
VehicleData
::
minRollSpeed
¶ Unused.
-
float
VehicleData
::
numDmgEmitterAreas
¶ Number of damageEmitterOffset values to use for each damageEmitter.
-
bool
VehicleData
::
powerSteering
¶ If true, steering does not auto-centre while the vehicle is being steered by its driver.
-
SFXProfile
VehicleData
::
softImpactSound
¶ Sound to play on a ‘soft’ impact. This sound is played if the impact speed is lt hardImpactSpeed and gt = softImpactSpeed.
-
float
VehicleData
::
softImpactSpeed
¶ Minimum collision speed for the softImpactSound to be played.
-
float
VehicleData
::
softSplashSoundVelocity
¶ Minimum velocity when entering the water for the imapactWaterEasy sound to play.
-
ParticleEmitterData
VehicleData
::
splashEmitter
[2]¶ Array of particle emitters used to generate splash effects.
-
float
VehicleData
::
splashFreqMod
¶ Number of splash particles to generate based on vehicle speed. This value is multiplied by the current speed to determine how many particles to generate each frame.
-
float
VehicleData
::
splashVelEpsilon
¶ Minimum speed when moving through water to generate splash particles.
-
float
VehicleData
::
steeringReturn
¶ Rate at which the vehicle’s steering returns to forwards when it is moving.
-
float
VehicleData
::
steeringReturnSpeedScale
¶ Amount of effect the vehicle’s speed has on its rate of steering return.
-
float
VehicleData
::
triggerDustHeight
¶ Maximum height above surface to emit dust particles. If the vehicle is less than triggerDustHeight above a static surface with a material that has ‘showDust’ set to true, the vehicle will emit particles from the dustEmitter.
-
SFXProfile
VehicleData
::
waterWakeSound
¶ Looping sound to play while moving through the water.