Game Development Community

Problem when handling collisions

by Asura · in Torque Game Builder · 07/24/2011 (9:08 am) · 1 replies

Hi all,

Probably quite an obvious question/answer for most here, but I'm having some trouble with onCollision. Here's a bit of pseudocode for what I'm trying to do:

function player::onCollision(%srcObject, %dstObject, %srcRef, %dstRef, %time, %normal, %contacts, %points)
{
if (%dstObject has a name in the TGB editor that I've set, such as "wall")
{
do this.
}
}

The problem I'm getting is that the compiler either doesn't understand the "if" statement, or when I try to use %dstObject.internalName I get a parse error saying "string always evaluates to 0" on the same line as the IF. Anyone know what I'm doing wrong here?

#1
07/24/2011 (5:08 pm)
Hi there -

I believe the internal name is only useful if you want to work in the SimGroup:
www.garagegames.com/community/forums/viewthread/61537

what does the script compiler say when you try something like:

if (%dstObject.getName() $= "Wall")
{
...
}

?

Regards