Game Development Community

LevelEditor::onCollision?

by Kevin James · in Torque Game Builder · 04/21/2006 (12:00 pm) · 5 replies

I'm trying to get the collision callback to work with the level editor, so I stuck this in my game.cs:

function t2dSceneObject::onCollision( %srcObj, %dstObj, %srcRef, %dstRef, %time, %normal, %contactCount, %contacts )
{
	// Handle Source Object.
	echo (%srcObj.tag);
	switch$( %srcObj.tag )
	{
		
	}
}

However, I never see an echo in the console.log. Which is strange because I have stuff bouncing off each other so I know collisions are working.

About the author

Computer security, digital forensics, and platform jumper enthusiast. shells.myw3b.net/~syreal/


#1
04/21/2006 (12:03 pm)
Try just echoing something like
echo("Collision: "@%srcObject@" -> "@%dstObj);
and see if that works. ;)

If something actually gets echo'ed to the console, then you know your function is being called. ;)
Also, check for a syntax error from that file, in the console. They are usually in red.
#2
04/21/2006 (12:10 pm)
Still nothing. The collisions aren't getting to this callback.

I noticed the level editor creates a blank sceneobject:
%levelContent = new t2dSceneGraph()

How am i supposed to reference it?
#3
04/21/2006 (12:26 pm)
Did you turn on the collision callback for the objects?
#4
04/21/2006 (12:29 pm)
No, why would I do something stupid like that?? Gasp...

Thanks Michael!
#5
04/21/2006 (12:39 pm)
Glad I could help :)