How do I use an object id?
by Josh Albrecht · in Torque Game Engine · 08/30/2001 (12:04 pm) · 4 replies
I am trying to make hitboxes work. To do this, I am modifying the cContainerRayCast (from the working gun example) function to check if a line collides with the player collision box. If I can do that, all I would then have to do is add the hitboxes on the model like collision meshes and identify them somehow so that each one can be checked for collision.
I hope that made sense...
Anyway, my problem is that I dont know how to access the Player class data from cContainerRayCast. I have no clue how I would go about doing that (I havent messed with any code this complex EVER). I have the id, obtained from this line of code (hopefully GG wont be mad for me posting this, it is only on small line):
ret = rinfo.object->getId();
The ret is the variable for return, and it is the id number of the object. I want to know how to tell if the object is a plyaer, and if so, how to call Player functions and access player data (specifically mConvex). This would be VERY helpful to me, and I will understand the engine ALOT better if somone would be so kind as to help me. Thanks alot!
I hope that made sense...
Anyway, my problem is that I dont know how to access the Player class data from cContainerRayCast. I have no clue how I would go about doing that (I havent messed with any code this complex EVER). I have the id, obtained from this line of code (hopefully GG wont be mad for me posting this, it is only on small line):
ret = rinfo.object->getId();
The ret is the variable for return, and it is the id number of the object. I want to know how to tell if the object is a plyaer, and if so, how to call Player functions and access player data (specifically mConvex). This would be VERY helpful to me, and I will understand the engine ALOT better if somone would be so kind as to help me. Thanks alot!
#2
if( rInfo.object->getTypeMask() & PlayerObjectType)
{...}
to check what kind of object it is.
-- Bob
08/30/2001 (2:12 pm)
I believe you can use something like:if( rInfo.object->getTypeMask() & PlayerObjectType)
{...}
to check what kind of object it is.
-- Bob
#3
However, it has been crashing on me. Just this line:
rinfo.object->getTypeMask();
Will cause it to crash. I am not even assigning it to anything!! Something seems messed up... :(
08/30/2001 (5:46 pm)
Yup, thats exactly what he told me. :)However, it has been crashing on me. Just this line:
rinfo.object->getTypeMask();
Will cause it to crash. I am not even assigning it to anything!! Something seems messed up... :(
#4
I figured it out. It was a problem with where I was calling the function from (sometimes I was calling a function from an object that didnt exist... :)
08/30/2001 (6:35 pm)
Me = dum.I figured it out. It was a problem with where I was calling the function from (sometimes I was calling a function from an object that didnt exist... :)
Torque Owner Josh Albrecht