TorqueScript/Datablocks/HoverVehicleData

From TDN

HoverVehicleData

HoverVehicleData also derives from VehicleData and aids the creation of hover-vehicle objects. HoverVehicleData defines a few fields beyond those described in VehicleData. These new fields are listed in the table below.

Field Name Type Default Value Description
Special Effects Data
jetSound AudioProfilePtr NULL Points to the AudioProfile used to produce sounds for the jet. 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.
engineSound AudioProfilePtr NULL Points to the AudioProfile used to produce sounds for the engine. 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.
floatSound AudioProfilePtr NULL Points to the AudioProfile used when the to indicate that the vehicle is floating. 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.
dustTrailEmitter ParticleEmitterDataPtr NULL Points to the ParticleEmitterData datablock used in the generation of the vehicle's dust trail. 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.
dustTrailOffset Point3F (0.0, 0.0, 0.0) The offset at which to generate dust particles from the point of contact between the vehicle and the terrain when the vehicle is in motion.
dustTrailFreqMod Float 15.0 The frequency modulation used to emit dust.
triggerTrailHeight Float 2.5 Maximum height the vehicle may be off the ground in order to begin generating a dust trail.



Physics Data
dragForce Float 0.0 Used to simulate the constant drag acting on the vehicle. Also used to determine the vehicle's maxThrustSpeed, ((mainThrustForce + StrafeThrustForce) / dragForce) Note: The dragForce must be at least 0.01. If it is a console error will be produced, and the engine will force the dragForce to 0.01. What is does: Constant drag force, slows more when not thrusting.
vertFactor Float 0.25 The scalar applied to the vertical portion of the velocity drag acting on a vehicle. This scalar factor is applied to vehicle's velocity whether or not it is floating. For the x- and y-components of velocity drag, a factor of 0.25 is applied when the vehicle is floating, and no factor is applied to the x- and y-components when the vehicle is not floating. This velocity drag is multiplied by the vehicle's dragForce, as defined above, and the result is subtracted from it's movement force. Note: The vertFactor must be between 0.0 and 1.0 (inclusive). If it is not, a console error will be generated, and the field's value will be clamped. What is does: 0-1 applys higher drag when "airborne"
floatingThrustFactor Float 0.15 The scalar factor applied to the vehicle's thrust force when the vehicle is floating. Note: The floatingThrustFactor must be between 0.0 and 1.0 (inclusive). If it is not, a console error will be produced, and the value will be clamped. What is does:if airborne then the stabLenMax multiple thrustforce by this to determine how much thrust to allow.
mainThrustForce Float 0.0 The force generated by thrusting the vehicle forward. Also used to determine the maximum volume of the engine sound (the vehicle's actual thrusting power is divided by mainThrustForce + strafeThrustForce in the determination of what percentage volume the engine sound should be played at). Also used to determine the vehicle's maxThrustSpeed, ((mainThrustForce + StrafeThrustForce) / dragForce) Note: The dragForce must be at least 0.01. If it is a console error will be produced, and the engine will force the dragForce to 0.01.
reverseThrustForce Float 0.0 The force generated by thrusting the vehicle backward.
strafeThrustForce Float 0.0 The force generated by thrusting the vehicle to a side. Also used to determine the maximum volume of the engine sound (the vehicle's actual thrusting power is divided by mainThrustForce + strafeThrustForce in the determination of what percentage volume the engine sound should be played at). Also used to determine the vehicle's maxThrustSpeed, ((mainThrustForce + StrafeThrustForce) / dragForce) Note: The dragForce must be at least 0.01. If it is a console error will be produced, and the engine will force the dragForce to 0.01.
turboFactor Float 1.0 The factor by which the vehicle's thrust force is scaled when jetting.
normalForce Float 30.0  What is does:normalize the vehicle roll and pitch with respect to the terrain. high numbers provide a stable smooth positioning. low numbers allow more roll and pitch and increases terrain collisions.
floatingGravMag Float 1.0 The factor by which the gravitational force affecting the vehicle is scaled when the vehicle is floating. What is does: higher numbers cuts out air time, keeping the vehicle very close to the terrain
brakingForce Float 1.0 The force generated by braking (vehicle is considered to be braking if the throttle is off, and no left or right thrust is being applied, but the vehicle is moving). brakingForce is applied only when the vehicle's velocity is less than brakingActivationSpeed, defined below.
brakingActivationSpeed Float 0.0 The maximum speed at which the vehicle may be travelling in order for brakingForce to be applied.
gyroDrag Float 10.0 The gyscropic drag which is scaled against the vehicle's angular momentem to dampen its rigid body torque. What is does: determines turning rate of vehicle lower values provide for quick turn responce, but are less normalized and hard to control. lower numbers also decrease the effect of the direction the vehicle is facing upon its actual direction of momentum
restorativeForce Float 10.0  What is does: how fast the vehicle will be restroed to parallel over the terrain, higher is faster.
steeringForce Float 25.0 The force applied to steering (rotation about the z-axis) maneuvers along the x-axis; affects the vehicle's rigid body torque. What is does: the rate of turn for the vehicle, higher is faster.
rollForce Float 2.5 The rolling (rotation about the y-axis) force applied when steering in the x-direction. What is does: the makes the rolling/banking (turning) more responsive (higher numbers reduces the ability to turn 180 degress without changing the direction of momentum.
pitchForce Float 2.5 The pitching (rotation about the x-axis) force applied to steering maneuvers along the y-axis. What is does: higher numbers give more force and movement for pitching the nose up/down
stabLenMin Float 0.5  What is does:for example if hovering you are basically riding on a spring, which during normal movement keeps the vehicle within the following values (distance) from the ground.
stabLenMax Float 2.0  What is does:for example if hovering you are basically riding on a spring, which during normal movement keeps the vehicle within the following values (distance) from the ground.
stabSpringConstant Float 30.0 The value used to generate spring force, by scaling against stabilizer compression. What is does: higher values provide for less bobbles from bumps and direction changes
stabDampingConstant Float 10.0 The scalar used to determine dampening force acting against the vehicles spring force. What is does: higher values quickly smooths out the residual up and down motion from landings and bumps



HoverVehicleData provides many new fields, and the opportunity for complex physical simulation.

Full Example Script

Here's a working full example - Check all the references to make sure this uses all the commands you need for your game. Particle and Sound Data has not yet been fully added. This script is best for a Hover Tank type vehicle.

//---------------------------------------------------------------------------------------
// Hover Vehicle Shape File
//---------------------------------------------------------------------------------------
// Vehicle Name: Gravity Tank
// Version: 1.0
//---------------------------------------------------------------------------------------
datablock HoverVehicleData(AssaultTank)
{
spawnOffset = "0 0 1";

floatingGravMag = 50.5;

category = "Vehicles";
shapeFile = "~/data/shapes/vehicles/gravtank.dts";
computeCRC = true;

debrisShapeName = "~/data/shapes/vehicle/gravtank.dts";
debris = ShapeDebris;
renderWhenDestroyed = false;

drag = 0.0;
density = 0.3;

mountPose[0] = scoutRoot;
cameraMaxDist = 15.0;
cameraOffset = 5.7;
cameraLag = 5.5;
numMountPoints = 3;
isProtectedMountPoint[0] = true;
explosion = AssaultTankExplosion;
explosionDamage = 0.5;
explosionRadius = 5.0;

lightOnly = 1;

maxDamage = 120;
destroyedLevel = 120;

isShielded = true;
rechargeRate = 0.7;
energyPerDamagePoint = 75;
maxEnergy = 150;
minJetEnergy = 15;
jetEnergyDrain = 1.3;

// Rigid Body
mass = 5;
bodyFriction = 0;
bodyRestitution = 0.5;
softImpactSpeed = 20; // Play SoftImpact Sound
hardImpactSpeed = 28; // Play HardImpact Sound

// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 29;
speedDamageScale = 0.010;

// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 23;
collDamageMultiplier = 0.030;

dragForce = 1.9;
// dragForce = 25 / 45.0;
vertFactor = 0.5;
floatingThrustFactor = 0.35;

mainThrustForce = 100;
reverseThrustForce = 70;
strafeThrustForce = 70;
turboFactor = 1.5;

brakingForce = 30;
brakingActivationSpeed = 30;

stabLenMin = 6.50;
stabLenMax = 7.25;
stabSpringConstant = 20;
stabDampingConstant = 20;

gyroDrag = 36; // 16
// gyroForce = 50
normalForce = 10;
restorativeForce = 100;
steeringForce = 90;
rollForce = 7;
pitchForce = 10;

dustEmitter = VehicleLiftoffDustEmitter;
triggerDustHeight = 2.5;
dustHeight = 1.0;
dustTrailEmitter = TireEmitter;
dustTrailOffset = "0.0 -1.0 0.5";
triggerTrailHeight = 3.6;
dustTrailFreqMod = 15.0;

jetSound = ScoutSqueelSound;
engineSound = ScoutEngineSound;
floatSound = ScoutThrustSound;
softImpactSound = GravSoftImpactSound;
hardImpactSound = HardImpactSound;
wheelImpactSound = WheelImpactSound;

//
softSplashSoundVelocity = 10.0;
mediumSplashSoundVelocity = 20.0;
hardSplashSoundVelocity = 30.0;
exitSplashSoundVelocity = 10.0;

exitingWater = VehicleExitWaterSoftSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterSoftSound;
impactWaterHard = VehicleImpactWaterMediumSound;
waterWakeSound = VehicleWakeSoftSplashSound;

minMountDist = 4;

damageEmitter[0] = AssaultTankEmitter;
damageEmitter[1] = AssaultTankEmitter;
damageEmitter[2] = AssaultTankEmitter;
damageEmitterOffset[0] = "0.0 -1.5 0.5 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.7;
numDmgEmitterAreas = 2;

splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;

max[chaingunAmmo] = 1000;

forwardJetEmitter = ContrailEmitter;//WildcatJetEmitter;

//cmdCategory = Tactical;
//cmdIcon = CMDHoverScoutIcon;
//cmdMiniIconName = "commander/MiniIcons/com_landscout_grey";
//targetNameTag = 'WildCat';
//targetTypeTag = 'Grav Cycle';
//sensorData = VehiclePulseSensor;

checkRadius = 1.7785;
observeParameters = "1 10 10";

//runningLight[0] = WildcatLight1;
//runningLight[1] = WildcatLight2;
//runningLight[2] = WildcatLight3;

shieldEffectScale = "0.9375 1.125 0.6";
};