Game Development Community

Why is %this missing from the onCollision callback?

by Scott Johnson · in Torque Game Builder · 08/21/2006 (9:28 pm) · 1 replies

Or

Is it that the %srcObject is always equal to %this ?

Of course this assumes that handling onCollision on a per object-instance basis

example:

function myobject::onCollision(%srcObject, %dstObject, %srcRef, %dstRef, %time, %normal, %contacts, %points)
{
//how can I determine which object is which.

//No %this to play with...

//I would like to be able to:
if (%this == %srcObject) { //do something cool here; }

}

Any ideas?

#1
08/21/2006 (9:36 pm)
%this is simply a naming convention. To Torque, it's always the first parameter that contains the ObjectID of the calling object.

For the most part, the code uses %this to maintain a similarity with c++, but in some specific cases, callbacks from the engine will use a different name for clarity's sake. Another one you will see occasionally is %client, since in the callbacks it is used in, the object doing the callback is always a handle to a specific client's GameConnection.