mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-26 10:03:48 +00:00
fixes for trigger onenter/onleave
1- corrects onleavetrigger for deletions 2-adds a testObjects to trip onenter when creating or moving a trigger itself so that that will list objects already there as opposed to only going off when something moves into it
This commit is contained in:
parent
341c7eeee1
commit
8ecb474a67
2 changed files with 21 additions and 2 deletions
|
|
@ -389,6 +389,20 @@ bool Trigger::setTickCmd(void *object, const char *index, const char *data)
|
|||
return true; // to update the actual field
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void Trigger::testObjects()
|
||||
{
|
||||
Vector<SceneObject*> foundobjs;
|
||||
gServerContainer.findObjectList(getWorldBox(), 0xFFFFFFFF, &foundobjs);
|
||||
for (S32 i = 0; i < foundobjs.size(); ++i)
|
||||
{
|
||||
GameBase* so = dynamic_cast<GameBase*>(foundobjs[i]);
|
||||
if (so)
|
||||
potentialEnterObject(so);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
bool Trigger::onAdd()
|
||||
|
|
@ -405,7 +419,9 @@ bool Trigger::onAdd()
|
|||
|
||||
if (isServerObject())
|
||||
scriptOnAdd();
|
||||
|
||||
|
||||
testObjects();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -441,7 +457,7 @@ void Trigger::onDeleteNotify( SimObject *obj )
|
|||
{
|
||||
mObjects.erase(i);
|
||||
if (mDataBlock)
|
||||
mDataBlock->onLeaveTrigger_callback( this, pScene );
|
||||
mDataBlock->onLeaveTrigger_callback( this, NULL );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -517,6 +533,8 @@ void Trigger::setTransform(const MatrixF & mat)
|
|||
|
||||
setMaskBits(TransformMask | ScaleMask);
|
||||
}
|
||||
|
||||
testObjects();
|
||||
}
|
||||
|
||||
void Trigger::prepRenderImage( SceneRenderState *state )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue