Flying Vechile Collision and Damage problem....
by Dallin Wellington · in Torque Game Engine · 12/26/2007 (4:48 pm) · 0 replies
Ok, i cant get collision or damage to work for the flying vehicle datablock, i have all the correct nodes, but it still dosnt seem to work :(
Here is my datablock:
Here is my datablock:
datablock FlyingVehicleData(F16)
{
emap = true;
category = "Vechiles";
shapeFile = "~/data/shapes/f16/f16.dts";
multipassenger = false;
computeCRC = true;
drag = 0.25;
density = 1.0;
//Physics
minDrag = 15; // Linear Drag (slows you down when not thrusting...)
rotationalDrag = 15; // Anguler Drag (dampens the drift after you stop moving the mouse...)
//Speed
maxAutoSpeed = 10;
autoAngularForce = 400;
autoLinearForce = 300;
autoInputDamping = 0.55;
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 10; // If hit ground at speed above this then it's an impact. Meters/second
speedDamageScale = 1.00;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 23.0;
collDamageMultiplier = 0.02;
//Mounting and Camera
cameraOffset = 3.0;
cameraRoll = true;
// Maneuvering
maxSteeringAngle = 3; // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
horizontalSurfaceForce = 20; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 20; // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
maneuveringForce = 6400; // Horizontal jets (W,S,D,A key thrust)
steeringForce = 500; // Steering jets (force applied when you move the mouse)
steeringRollForce = 200; // Steering jets (how much you heel over when you turn)
rollForce = 10; // Auto-roll (self-correction to right you after you roll/invert)
hoverHeight = 0.5; // Height off the ground at rest
createHoverHeight = 0.5; // Height off the ground when created
maxForwardSpeed = 90; // speed in which forward thrust force is no longer applied (meters/second)
// Rigid body
mass = 100; // Mass of the vehicle
integration = 1; // Physics integration: TickSec/Rate
collisionTol = 0.6; // Collision distance tolerance
contactTol = 0.4; // Contact velocity tolerance
bodyFriction = 0; // Don't mess with this.
bodyRestitution = 0.8; // When you hit the ground, how much you rebound. (between 0 and 1)
minRollSpeed = 2000; // Don't mess with this.
softImpactSpeed = 3; // Sound hooks. This is the soft hit.
hardImpactSpeed = 15; // Sound hooks. This is the hard hit.
};
//----------------------------------------------------------------------------------------
// Game Functions
//----------------------------------------------------------------------------------------
function Flyer::onCollision(%this,%obj,%col,%vec,%speed)
{
// Collision with other objects, including items
echo("Ahhhhhhh!!!!!");
}
function Flyer::onDamage(%this, %obj, %delta)
{
Parent::onDamage(%this, %obj);
%currentDamage = %obj.getDamageLevel();
if(%currentDamage > %obj.destroyedLevel)
{
if(%obj.getDamageState() !$= "Destroyed")
{
if(%obj.respawnTime !$= "")
%obj.marker.schedule = %obj.marker.data.schedule(%obj.respawnTime, "respawn", %obj.marker);
%obj.setDamageState(Destroyed);
}
}
else
{
if(%obj.getDamageState() !$= "Enabled")
%obj.setDamageState(Enabled);
}
}