How does onCollision work in TGBX?
by Sam M · in Torque X 2D · 02/17/2007 (12:14 pm) · 3 replies
I'm wondering how to set up an onCollision method in TGBX. I noticed there's a drop down box similar to the add component drop down box. Does onCollision work the same way? And further more what code do I need to get it onCollision working? Any help would be great, thanks.
#2
02/18/2007 (3:49 pm)
Cool, thanks. But I'm not sure what I'm supposed to do with this code. What file(s) should it go in to?
#3
(Scroll down in the thread here for those interested http://garagegames.com/mg/forums/result.thread.php?qt=57618)
02/18/2007 (4:09 pm)
Ah, nevermind, I found a post that explained it. Thanks for the help anyway.(Scroll down in the thread here for those interested http://garagegames.com/mg/forums/result.thread.php?qt=57618)
Torque Owner Luke Larson
onCollision is a delegate that you set that will be called when a collision occurs. For example:
This will set the delegate to whatever function you want it to be with the correct parameters.
public void OnCollision(T2DSceneObject srcObject, T2DSceneObject dstObject, T2DCollisionInfo info, ref T2DResolveCollisionDelegate resolve, ref T2DPhysicsMaterial physicsMaterial) { // do stuff for collision }This is the method with the correct parameters.