Function WheeledVehicleData::onCollision(%this,%obj,%col,%vec,%s
by Dan - · in Torque Game Engine · 12/13/2003 (8:56 am) · 3 replies
I am new and I have been working with the
function WheeledVehicleData::onCollision(%this,%obj,%col,%vec,%speed)
function in the wheeled vechiles.
What I want to do is when the onCollision function fires I want to message all saying " was run over by "
with that I have done:
messageAll('MsgClientKilled','%1 was run over by %2',%col.getShapeName(),%obj.client.player.name);
This displays the message
" was run over by "
So I am 1/2 way there.
I have tried several different methods but they all result in the second name being blank.
Any thoughts?
Outside of this problem directly does anyone know of a good "debug" method that would have helped me out?
For example
1 - Is there a method to figure out what code calls the onCollision? From the calling function I might have been able to figure out what the vars are. There are different onCollision events for shapes and cars and the like and all of them seem to have slightly different parameters.
2 - Is there a debug way to dump out or show an object's tree giving an object. Something like "Log %obj" which would dump to the log file all the vars with the current values.
I am very new so I can find a leave on the tree but I am having trouble finding the tree. :)
Thank you,
function WheeledVehicleData::onCollision(%this,%obj,%col,%vec,%speed)
function in the wheeled vechiles.
What I want to do is when the onCollision function fires I want to message all saying "
with that I have done:
messageAll('MsgClientKilled','%1 was run over by %2',%col.getShapeName(),%obj.client.player.name);
This displays the message
"
So I am 1/2 way there.
I have tried several different methods but they all result in the second name being blank.
Any thoughts?
Outside of this problem directly does anyone know of a good "debug" method that would have helped me out?
For example
1 - Is there a method to figure out what code calls the onCollision? From the calling function I might have been able to figure out what the vars are. There are different onCollision events for shapes and cars and the like and all of them seem to have slightly different parameters.
2 - Is there a debug way to dump out or show an object's tree giving an object. Something like "Log %obj" which would dump to the log file all the vars with the current values.
I am very new so I can find a leave on the tree but I am having trouble finding the tree. :)
Thank you,
#2
Solution is:
---------------
messageAll('MsgClientKilled','%1 was run over by %2.',%col.getShapeName(),%obj.getControllingClient().nameBase);
----------------
Although hitting someone isn't always "runing them over" so I have a bit more tweeking to do on that function.
Thanks for the help!
12/13/2003 (10:56 am)
Didn't know about the .dump() of an object. VERY useful. That helped me figure it out.Solution is:
---------------
messageAll('MsgClientKilled','%1 was run over by %2.',%col.getShapeName(),%obj.getControllingClient().nameBase);
----------------
Although hitting someone isn't always "runing them over" so I have a bit more tweeking to do on that function.
Thanks for the help!
#3
Had forgotten about this one.
:+}
09/22/2006 (6:01 am)
Thanks for this information. The Dump command certainly helps a Noob like me.Had forgotten about this one.
:+}
Associate Kyle Carter