aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs35
1 files changed, 18 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index 644bc7e..64bf395 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -282,30 +282,31 @@ public abstract class BSPhysObject : PhysicsActor
282 282
283 // 'actors' act on the physical object to change or constrain its motion. These can range from 283 // 'actors' act on the physical object to change or constrain its motion. These can range from
284 // hovering to complex vehicle motion. 284 // hovering to complex vehicle motion.
285 // May be called at non-taint time as this just adds the actor to the action list and the real
286 // work is done during the simulation step.
287 // Note that, if the actor is already in the list and we are disabling same, the actor is just left
288 // in the list disabled.
285 public delegate BSActor CreateActor(); 289 public delegate BSActor CreateActor();
286 public void CreateRemoveActor(bool createRemove, string actorName, bool inTaintTime, CreateActor creator) 290 public void EnableActor(bool enableActor, string actorName, CreateActor creator)
287 { 291 {
288 if (createRemove) 292 lock (PhysicalActors)
289 { 293 {
290 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.CreateRemoveActor:" + actorName, delegate() 294 BSActor theActor;
295 if (PhysicalActors.TryGetActor(actorName, out theActor))
291 { 296 {
292 if (!PhysicalActors.HasActor(actorName)) 297 // The actor already exists so just turn it on or off
293 { 298 theActor.Enabled = enableActor;
294 DetailLog("{0},BSPrim.CreateRemoveActor,taint,registerActor,a={1}", LocalID, actorName); 299 }
295 PhysicalActors.Add(actorName, creator()); 300 else
296 }
297 });
298 }
299 else
300 {
301 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.CreateRemoveActor:" + actorName, delegate()
302 { 301 {
303 if (PhysicalActors.HasActor(actorName)) 302 // The actor does not exist. If it should, create it.
303 if (enableActor)
304 { 304 {
305 DetailLog("{0},BSPrim.CreateRemoveActor,taint,unregisterActor,a={1}", LocalID, actorName); 305 theActor = creator();
306 PhysicalActors.RemoveAndRelease(actorName); 306 PhysicalActors.Add(actorName, theActor);
307 theActor.Enabled = true;
307 } 308 }
308 }); 309 }
309 } 310 }
310 } 311 }
311 312