Overriding onCollision in script for a class object
by Rob Segal · in Torque Game Builder · 07/11/2006 (5:07 pm) · 8 replies
If I declare a class object as follows....
I know I've seen somewhere you can override the onCollision method for all objects of this particular class. Something like...
But I'm not sure of the parameters here hence the ellipses. Would I be correct that you can do this and if so what are the parameters I'm missing here?
%myObj = new ScriptObject()
{
class = "MyClass";
};I know I've seen somewhere you can override the onCollision method for all objects of this particular class. Something like...
function MyClass::onCollision(...)
{
}But I'm not sure of the parameters here hence the ellipses. Would I be correct that you can do this and if so what are the parameters I'm missing here?
#2
07/11/2006 (7:58 pm)
That's correct, ScriptObjects don't have collision. They don't even have position or rotation.
#3
07/11/2006 (10:33 pm)
Great thanks Chris I will try that out.
#4
07/11/2006 (10:41 pm)
Great thanks Chris I will try that out.
#5
07/11/2006 (11:46 pm)
Thomas, that's wrong... ScriptObjects do have collisions. I'm using ScriptObjects as invisible obstacles in my game.
#6
07/12/2006 (12:11 am)
@Oliver - Are you sure you don't mean t2dSceneObjects? I might have missed something though...
#7
07/12/2006 (12:13 am)
Oh yeah, sorry, my bad! Still too early in the morning. ;)
#8
07/12/2006 (1:03 pm)
You had me confused for a sec.. ;)
Torque Owner Chris Cockcroft
This works, though your object needs to be registered to receive a callback on collision. Check the docs for a description of the parameters.
Chris
[edit] Not sure if this works on ScriptObjects - just t2dSceneObjects and its subclasses. [/edit]