BulletSim: fix problem where pre-step actions would not replaced

by new registrations thus causing multiple instances of an action.
user_profiles
Robert Adams 2013-01-03 19:34:14 -08:00
parent 2eda385f5e
commit 92a6958b6d
1 changed files with 4 additions and 0 deletions

View File

@ -343,6 +343,10 @@ public abstract class BSPhysObject : PhysicsActor
protected void RegisterPreStepAction(string op, uint id, BSScene.PreStepAction actn)
{
string identifier = op + "-" + id.ToString();
// Clean out any existing action
UnRegisterPreStepAction(op, id);
RegisteredActions[identifier] = actn;
PhysicsScene.BeforeStep += actn;
DetailLog("{0},BSPhysObject.RegisterPreStepAction,id={1}", LocalID, identifier);