How to parse the result of CastCollision
by Teddy Setiawan Wijaya · in Torque Game Builder · 10/02/2006 (1:55 am) · 6 replies
Hi All!
A newbie question here....;-(
Does anyone have example code on how to parse the result of castCollision?
I've read in the reference that castCollision returns a list in the form of "object time contact normal", where object is the object to be collided with.
How do I get the object name from this list?
Many thanks,
A newbie question here....;-(
Does anyone have example code on how to parse the result of castCollision?
I've read in the reference that castCollision returns a list in the form of "object time contact normal", where object is the object to be collided with.
How do I get the object name from this list?
Many thanks,
#2
After I get the object id (for example: 2829), how do I get the object name?
I have tried using
but it doesn't seem to work (the response seems to be always false)
Thanks again,
10/02/2006 (3:16 am)
Michael, thank you for the response.After I get the object id (for example: 2829), how do I get the object name?
I have tried using
if (%object == nameToID("frontDoor"))
{
// some code here
}but it doesn't seem to work (the response seems to be always false)
Thanks again,
#3
And strings have to be compared with the '$=' operator, not '=='.
10/02/2006 (3:32 am)
Try %object.getName().And strings have to be compared with the '$=' operator, not '=='.
#4
10/02/2006 (6:48 am)
%frontDoor = frontDoor.getId();
error("object: " @ %object);
error("frontDoor: " @ %frontDoor);
if (%object == %frontDoor)
{
// blah
}Run this code and check out the console. You should see in red the ids of both objects. Make sure they actually are equal as you expect them to be.
#5
10/02/2006 (1:05 pm)
Speaking of castCollision... I don't think it's working properly: www.garagegames.com/mg/forums/result.thread.php?qt=50707
#6
Thank you for the information, I use %object.getName() as told by Michael and compare it with the object name (frontDoor) using $=
Works for me...;-)
10/03/2006 (1:57 am)
Ben, Michael,Thank you for the information, I use %object.getName() as told by Michael and compare it with the object name (frontDoor) using $=
Works for me...;-)
Torque Owner Michael Woerister
Hope that helps.