Throwing Pilot based on Vehicle Impact Vector
by Gibby · in Technical Issues · 02/09/2010 (1:44 pm) · 1 replies
Greets All...
Some of my vehicles can 'ollie' and do tricks while airborne. I'm now trying to throw the rider if his impact angle is too steep. I've modded the impact function but I can't figure out which values to use as the threshold. I thought making the y z angles greater than 45 would work but it doesn't. Can someone explain this for me?
Here's my function:
Thanks
G
Some of my vehicles can 'ollie' and do tricks while airborne. I'm now trying to throw the rider if his impact angle is too steep. I've modded the impact function but I can't figure out which values to use as the threshold. I thought making the y z angles greater than 45 would work but it doesn't. Can someone explain this for me?
Here's my function:
function JetBikeData::onImpact(%data, %obj, %col, %vec, %vecLen)
{
//error("VehicleData::onImpact(" SPC %data.getName() @", "@ %obj.getClassName() @", "@ %col @", "@ %vec @", "@ %vecLen SPC ")");
if ( %vecLen > %data.minImpactSpeed )
%obj.damage( 0, VectorAdd(%obj.getPosition(), %vec), %vecLen * %data.speedDamageScale, "Impact" );
// associated "crash" sounds
if(%vecLen > %data.hardImpactSpeed)
%obj.playAudio(0, %data.hardImpactSound);
else if(%vecLen > %data.softImpactSpeed)
%obj.playAudio(0, %data.softImpactSound);
%x = getWord(%vec, 0);
%y = getWord(%vec, 1);
%z = getWord(%vec, 2);
echo ("*************************************** Vehicle Vector is " @ %vec);
if (%y < 45 || %y < -45 || %z <45 || %z < -45) //<-Gibby:what should these be?
echo ("******* Bought The Farm - Throw Player and Damage Him Here");
return;
} Thanks
G
Torque Owner Gibby
faderboy digital media
function JetBikeData::onImpact(%data, %obj, %col, %vec, %vecLen) { //error("VehicleData::onImpact(" SPC %data.getName() @", "@ %obj.getClassName() @", "@ %col @", "@ %vec @", "@ %vecLen SPC ")"); if ( %vecLen > %data.minImpactSpeed ) %obj.damage( 0, VectorAdd(%obj.getPosition(), %vec), %vecLen * %data.speedDamageScale, "Impact" ); // associated "crash" sounds if(%vecLen > %data.hardImpactSpeed) %obj.playAudio(0, %data.hardImpactSound); else if(%vecLen > %data.softImpactSpeed) %obj.playAudio(0, %data.softImpactSound); %trans = %obj.getTransform(); %tx = getword(%trans, 0); // first, get the current transform values %ty = getword(%trans, 1); %tz = getword(%trans, 2); %rx = getword(%trans, 3); %ry = getword(%trans, 4); %rz = getword(%trans, 5); echo ("*************************************** Vehicle Transform is " @ %trans); if (%ry < 1.2 || %ry > -1.2 || %rz < 1.2 || %rz > -1.2) echo ("******* Bought The Farm - Throw Player and Damage Him Here"); return; }