Potential Alpha bug
by Toby Mckenzie · in Torque Game Builder · 01/09/2006 (11:53 am) · 3 replies
Just being using PickRect and it seems to be ignoring the excludeObjectId option ( I presume I am using it correctly i.e. just passing in the object to it)
--Toby
--Toby
About the author
#2
Obviously the conditional block is just there to ignore finding the object I wish to ignore, without it I will find this object. There is not a missing bracket at the end of the pickRect it just is not showing up in the post (presume the line is too long)
01/16/2006 (5:43 am)
Without posting a large amount of supporting code I can only provide a near useless fragment:%objectIds = t2dscene.pickRect(%angel.getPositionX()-0.5 SPC %angel.getPositionY() , %angel.getPositionX()+0.5 SPC %angel.getPositionY()+15 , BIT($ZombieGroup),BIT($ZombieLayer),false,%angel ) ;
//Look for an object that is not %angel
if (getWord(%objectIds,0) == %angel)
{
%zombie = getWord(%objectIds,1) ;
}
else
{
%zombie = getWord(%objectIds,0) ;
}Obviously the conditional block is just there to ignore finding the object I wish to ignore, without it I will find this object. There is not a missing bracket at the end of the pickRect it just is not showing up in the post (presume the line is too long)
#3
Edit: To clarify, remove the t2dSceneObject* from the beginning of the line, not the one inside the < >.
01/16/2006 (9:12 am)
I actually just ran across this in a pass I was doing over all the console methods. All the pick functions have a section like this in them:// Get Optional Exclude Object.
t2dSceneObject* pSceneObject2D = NULL;
if ( argc >= 8 )
{
// Find t2dSceneObject Object.
t2dSceneObject* pSceneObject2D = dynamic_cast<t2dSceneObject*>(Sim::findObject(argv[7]));
// Validate Object.
if ( !pSceneObject2D )
{
Con::warnf("t2dSceneGraph::pickRect() - Couldn't find/Invalid object '%s'.", argv[7]);
return NULL;
}
}If you look closely you'll notice that pSceneObject2D is being declared twice, therefore the actual object is local to the if block and pSceneObject2D remains NULL always. Simple fix. Just remove 't2dSceneObject*' from the dynamic_cast line.Edit: To clarify, remove the t2dSceneObject* from the beginning of the line, not the one inside the < >.
Associate Justin DuJardin
Default Studio Name
From what I can tell this is not a known issue, if you could post the relevent code/script associated with reproducing this problem it would help me to better determine what if any is the cause.
Regards,
-Justin