3 Stupid Questions regarding Tutorials
by Bruno Grieco · in Torque Game Engine · 04/27/2004 (6:51 am) · 3 replies
Ok Guys,
I bet you can help me with this. All the questions are regarding Kevin Harris' torque tutorials at
http://www.codesampler.com/torque.htm
Q1) on the shapes & collision tutorial, there is a superbom class with a onCollision Method that echoes "superbomb activated" with the %this, %obj, %col parameters. In the superbomb creation method, it sets a rotate attribute to true. I want to modify it so it sets the rotate to false ( and true again ) when a collision occurs.
I tried %obj.rotate = false; in the collision method but the superbomb doesn't stop rotating.
How do I stop it from rotating ?
Q2) still on this same method. How do I test the class of the object that colides with it.
echo("%col.datablock"); shows "myPlayer" or "myBot". But if (%col.datablock $= "myBot") don't compile. tested with == myBot instead of $= "MyBot" and it didn't work also. How do I test classes ?
Q3) In the Bot Path-Finding Tutorial :
How do I spawn more than 1 bot ?
TIA
Bruno
I bet you can help me with this. All the questions are regarding Kevin Harris' torque tutorials at
http://www.codesampler.com/torque.htm
Q1) on the shapes & collision tutorial, there is a superbom class with a onCollision Method that echoes "superbomb activated" with the %this, %obj, %col parameters. In the superbomb creation method, it sets a rotate attribute to true. I want to modify it so it sets the rotate to false ( and true again ) when a collision occurs.
I tried %obj.rotate = false; in the collision method but the superbomb doesn't stop rotating.
How do I stop it from rotating ?
Q2) still on this same method. How do I test the class of the object that colides with it.
echo("%col.datablock"); shows "myPlayer" or "myBot". But if (%col.datablock $= "myBot") don't compile. tested with == myBot instead of $= "MyBot" and it didn't work also. How do I test classes ?
Q3) In the Bot Path-Finding Tutorial :
How do I spawn more than 1 bot ?
TIA
Bruno
About the author
#2
The onCollision function I assume has a few parameters, one of the parameters will be the obj you collide with.
04/27/2004 (10:54 pm)
Once again i also don't have my code on me so I can't give a definative answered BUT the function you are looking for is the onCollision function.The onCollision function I assume has a few parameters, one of the parameters will be the obj you collide with.
#3
If I echo %obj.datablock.rotate, I get a zero ( supposed to be false ). But the box still rotates.
but rotate is not a part of the datablock.
Superbomb inherits from ItemData and is of Item Class ( I'm actually a little mixed up with this so please correct me )
rotate is not a part of ItemData, it's a part of the Item Class. So I can get it's rotation state by echoing %obj.isRotating() but I can't set it.
I'm still not sure if I completely understood the differences between a Datablock and a Class.
04/28/2004 (6:14 am)
Nope,If I echo %obj.datablock.rotate, I get a zero ( supposed to be false ). But the box still rotates.
but rotate is not a part of the datablock.
Superbomb inherits from ItemData and is of Item Class ( I'm actually a little mixed up with this so please correct me )
rotate is not a part of ItemData, it's a part of the Item Class. So I can get it's rotation state by echoing %obj.isRotating() but I can't set it.
I'm still not sure if I completely understood the differences between a Datablock and a Class.
Torque Owner Devon Ly
I don't have my code with me so this is just a guess but maybe it would be along the lines of
%obj.datablock.rotate = false;