Game Development Community

StaticShape onCollision Player velocity

by Todd Harbour · in Torque Game Engine · 11/14/2004 (7:53 am) · 1 replies

Hi all. Sorry to be asking yet another question but I just thought someone may already have a solution.

I have an object:

datablock StaticShapeData( MyObject )

And a collision function:

function MyObject::onCollision( %this, %obj, %col )

Now the problem is I am wanting to react differently depending on %col's (player mainly) velocity on collision. Unfortunately, %col.getVelocity() returns near 0 results no matter what. I assume it's already been reset by the time this onCollision function is called.

I noted also that Armor::onCollision also returns the same result. The only function I can find that contains anything that relates to velocity is the Armor::onImpact which is passed a velocity vector when called.

Ideally I would like the onCollision function for MyObject to contain a velocity vector too.

Has anyone already done something like this?

Any help at all (or comments) is appreciated.

#1
11/14/2004 (1:18 pm)
Have you considered looking at the onCollision callback code from the c++ side? It might be as simple as moving the call around slightly.