Some extra code was needed though to expose UFO's linear velocity to the script, so that I will be able to calculate impact damage during collision.
I added the following code to the t2dPhysics::resolveClampCollision method, at the end of if ( solveDst ) statement:
// notify the colliding object about its linear speed during impact
F32 currentCollisionSpeed = linearVelocity.len();
Con::executef(
Con::executef(
pCollisionStatus->mDstObject,
2,
"processCollisionImpact",
Con::getFloatArg(currentCollisionSpeed) );
That way every time my UFO hits another object, the following script funcion will be called:
function player::processCollisionImpact( %this, %collisionSpeed )
{
}

No comments:
Post a Comment