aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
authorRobert Adams2012-08-09 15:17:19 -0700
committerRobert Adams2012-08-09 15:17:19 -0700
commit320982cae388814b8e7e9e9fe62724caa9621d90 (patch)
treeef2d7bd50cfb5276b7573022867d812446a2e54e /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
parentBulletSim: separate out the constraints by type. The linksets use (diff)
downloadopensim-SC-320982cae388814b8e7e9e9fe62724caa9621d90.zip
opensim-SC-320982cae388814b8e7e9e9fe62724caa9621d90.tar.gz
opensim-SC-320982cae388814b8e7e9e9fe62724caa9621d90.tar.bz2
opensim-SC-320982cae388814b8e7e9e9fe62724caa9621d90.tar.xz
BulletSim: add an identifier to the TaintObject call so exceptions that happen when the taint is invoked can be debugged
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs49
1 files changed, 22 insertions, 27 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index e0f6ed2..988e03b 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -145,7 +145,7 @@ public sealed class BSPrim : PhysicsActor
145 _vehicle = new BSDynamics(this); // add vehicleness 145 _vehicle = new BSDynamics(this); // add vehicleness
146 _mass = CalculateMass(); 146 _mass = CalculateMass();
147 // do the actual object creation at taint time 147 // do the actual object creation at taint time
148 _scene.TaintedObject(delegate() 148 _scene.TaintedObject("BSPrim.create", delegate()
149 { 149 {
150 RecreateGeomAndObject(); 150 RecreateGeomAndObject();
151 151
@@ -166,7 +166,7 @@ public sealed class BSPrim : PhysicsActor
166 _vehicle.ProcessTypeChange(Vehicle.TYPE_NONE); 166 _vehicle.ProcessTypeChange(Vehicle.TYPE_NONE);
167 _scene.RemoveVehiclePrim(this); // just to make sure 167 _scene.RemoveVehiclePrim(this); // just to make sure
168 168
169 _scene.TaintedObject(delegate() 169 _scene.TaintedObject("BSPrim.destroy", delegate()
170 { 170 {
171 // Undo any links between me and any other object 171 // Undo any links between me and any other object
172 _linkset = _linkset.RemoveMeFromLinkset(this); 172 _linkset = _linkset.RemoveMeFromLinkset(this);
@@ -183,7 +183,7 @@ public sealed class BSPrim : PhysicsActor
183 get { return _size; } 183 get { return _size; }
184 set { 184 set {
185 _size = value; 185 _size = value;
186 _scene.TaintedObject(delegate() 186 _scene.TaintedObject("BSPrim.setSize", delegate()
187 { 187 {
188 _mass = CalculateMass(); // changing size changes the mass 188 _mass = CalculateMass(); // changing size changes the mass
189 BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical); 189 BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical);
@@ -195,7 +195,7 @@ public sealed class BSPrim : PhysicsActor
195 public override PrimitiveBaseShape Shape { 195 public override PrimitiveBaseShape Shape {
196 set { 196 set {
197 _pbs = value; 197 _pbs = value;
198 _scene.TaintedObject(delegate() 198 _scene.TaintedObject("BSPrim.setShape", delegate()
199 { 199 {
200 _mass = CalculateMass(); // changing the shape changes the mass 200 _mass = CalculateMass(); // changing the shape changes the mass
201 RecreateGeomAndObject(); 201 RecreateGeomAndObject();
@@ -213,7 +213,7 @@ public sealed class BSPrim : PhysicsActor
213 public override bool Selected { 213 public override bool Selected {
214 set { 214 set {
215 _isSelected = value; 215 _isSelected = value;
216 _scene.TaintedObject(delegate() 216 _scene.TaintedObject("BSPrim.setSelected", delegate()
217 { 217 {
218 SetObjectDynamic(); 218 SetObjectDynamic();
219 }); 219 });
@@ -281,7 +281,7 @@ public sealed class BSPrim : PhysicsActor
281 set { 281 set {
282 _position = value; 282 _position = value;
283 // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint? 283 // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint?
284 _scene.TaintedObject(delegate() 284 _scene.TaintedObject("BSPrim.setPosition", delegate()
285 { 285 {
286 DetailLog("{0},SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 286 DetailLog("{0},SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
287 BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation); 287 BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation);
@@ -318,7 +318,7 @@ public sealed class BSPrim : PhysicsActor
318 get { return _force; } 318 get { return _force; }
319 set { 319 set {
320 _force = value; 320 _force = value;
321 _scene.TaintedObject(delegate() 321 _scene.TaintedObject("BSPrim.setForce", delegate()
322 { 322 {
323 DetailLog("{0},setForce,taint,force={1}", LocalID, _force); 323 DetailLog("{0},setForce,taint,force={1}", LocalID, _force);
324 // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); 324 // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force);
@@ -333,7 +333,7 @@ public sealed class BSPrim : PhysicsActor
333 } 333 }
334 set { 334 set {
335 Vehicle type = (Vehicle)value; 335 Vehicle type = (Vehicle)value;
336 _scene.TaintedObject(delegate() 336 _scene.TaintedObject("BSPrim.setVehicleType", delegate()
337 { 337 {
338 DetailLog("{0},SetVehicleType,taint,type={1}", LocalID, type); 338 DetailLog("{0},SetVehicleType,taint,type={1}", LocalID, type);
339 _vehicle.ProcessTypeChange(type); 339 _vehicle.ProcessTypeChange(type);
@@ -343,12 +343,7 @@ public sealed class BSPrim : PhysicsActor
343 } 343 }
344 else 344 else
345 { 345 {
346 _scene.TaintedObject(delegate() 346 BulletSimAPI.ClearForces2(this.Body.Ptr);
347 {
348 // Tell the physics engine to clear state
349 BulletSimAPI.ClearForces2(this.Body.Ptr);
350 });
351
352 // make it so the scene will call us each tick to do vehicle things 347 // make it so the scene will call us each tick to do vehicle things
353 _scene.AddVehiclePrim(this); 348 _scene.AddVehiclePrim(this);
354 } 349 }
@@ -358,28 +353,28 @@ public sealed class BSPrim : PhysicsActor
358 } 353 }
359 public override void VehicleFloatParam(int param, float value) 354 public override void VehicleFloatParam(int param, float value)
360 { 355 {
361 _scene.TaintedObject(delegate() 356 _scene.TaintedObject("BSPrim.VehicleFloatParam", delegate()
362 { 357 {
363 _vehicle.ProcessFloatVehicleParam((Vehicle)param, value, _scene.LastSimulatedTimestep); 358 _vehicle.ProcessFloatVehicleParam((Vehicle)param, value, _scene.LastSimulatedTimestep);
364 }); 359 });
365 } 360 }
366 public override void VehicleVectorParam(int param, OMV.Vector3 value) 361 public override void VehicleVectorParam(int param, OMV.Vector3 value)
367 { 362 {
368 _scene.TaintedObject(delegate() 363 _scene.TaintedObject("BSPrim.VehicleVectorParam", delegate()
369 { 364 {
370 _vehicle.ProcessVectorVehicleParam((Vehicle)param, value, _scene.LastSimulatedTimestep); 365 _vehicle.ProcessVectorVehicleParam((Vehicle)param, value, _scene.LastSimulatedTimestep);
371 }); 366 });
372 } 367 }
373 public override void VehicleRotationParam(int param, OMV.Quaternion rotation) 368 public override void VehicleRotationParam(int param, OMV.Quaternion rotation)
374 { 369 {
375 _scene.TaintedObject(delegate() 370 _scene.TaintedObject("BSPrim.VehicleRotationParam", delegate()
376 { 371 {
377 _vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); 372 _vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation);
378 }); 373 });
379 } 374 }
380 public override void VehicleFlags(int param, bool remove) 375 public override void VehicleFlags(int param, bool remove)
381 { 376 {
382 _scene.TaintedObject(delegate() 377 _scene.TaintedObject("BSPrim.VehicleFlags", delegate()
383 { 378 {
384 _vehicle.ProcessVehicleFlags(param, remove); 379 _vehicle.ProcessVehicleFlags(param, remove);
385 }); 380 });
@@ -397,7 +392,7 @@ public sealed class BSPrim : PhysicsActor
397 public override void SetVolumeDetect(int param) { 392 public override void SetVolumeDetect(int param) {
398 bool newValue = (param != 0); 393 bool newValue = (param != 0);
399 _isVolumeDetect = newValue; 394 _isVolumeDetect = newValue;
400 _scene.TaintedObject(delegate() 395 _scene.TaintedObject("BSPrim.SetVolumeDetect", delegate()
401 { 396 {
402 SetObjectDynamic(); 397 SetObjectDynamic();
403 }); 398 });
@@ -408,7 +403,7 @@ public sealed class BSPrim : PhysicsActor
408 get { return _velocity; } 403 get { return _velocity; }
409 set { 404 set {
410 _velocity = value; 405 _velocity = value;
411 _scene.TaintedObject(delegate() 406 _scene.TaintedObject("BSPrim.setVelocity", delegate()
412 { 407 {
413 DetailLog("{0},SetVelocity,taint,vel={1}", LocalID, _velocity); 408 DetailLog("{0},SetVelocity,taint,vel={1}", LocalID, _velocity);
414 BulletSimAPI.SetObjectVelocity(_scene.WorldID, LocalID, _velocity); 409 BulletSimAPI.SetObjectVelocity(_scene.WorldID, LocalID, _velocity);
@@ -442,7 +437,7 @@ public sealed class BSPrim : PhysicsActor
442 set { 437 set {
443 _orientation = value; 438 _orientation = value;
444 // TODO: what does it mean if a child in a linkset changes its orientation? Rebuild the constraint? 439 // TODO: what does it mean if a child in a linkset changes its orientation? Rebuild the constraint?
445 _scene.TaintedObject(delegate() 440 _scene.TaintedObject("BSPrim.setOrientation", delegate()
446 { 441 {
447 // _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID); 442 // _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID);
448 DetailLog("{0},setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); 443 DetailLog("{0},setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation);
@@ -459,7 +454,7 @@ public sealed class BSPrim : PhysicsActor
459 get { return _isPhysical; } 454 get { return _isPhysical; }
460 set { 455 set {
461 _isPhysical = value; 456 _isPhysical = value;
462 _scene.TaintedObject(delegate() 457 _scene.TaintedObject("BSPrim.setIsPhysical", delegate()
463 { 458 {
464 SetObjectDynamic(); 459 SetObjectDynamic();
465 }); 460 });
@@ -547,7 +542,7 @@ public sealed class BSPrim : PhysicsActor
547 set { 542 set {
548 _rotationalVelocity = value; 543 _rotationalVelocity = value;
549 // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); 544 // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity);
550 _scene.TaintedObject(delegate() 545 _scene.TaintedObject("BSPrim.setRotationalVelocity", delegate()
551 { 546 {
552 DetailLog("{0},SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); 547 DetailLog("{0},SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity);
553 BulletSimAPI.SetObjectAngularVelocity(_scene.WorldID, LocalID, _rotationalVelocity); 548 BulletSimAPI.SetObjectAngularVelocity(_scene.WorldID, LocalID, _rotationalVelocity);
@@ -564,7 +559,7 @@ public sealed class BSPrim : PhysicsActor
564 get { return _buoyancy; } 559 get { return _buoyancy; }
565 set { 560 set {
566 _buoyancy = value; 561 _buoyancy = value;
567 _scene.TaintedObject(delegate() 562 _scene.TaintedObject("BSPrim.setBuoyancy", delegate()
568 { 563 {
569 DetailLog("{0},SetBuoyancy,taint,buoy={1}", LocalID, _buoyancy); 564 DetailLog("{0},SetBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
570 BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, _localID, _buoyancy); 565 BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, _localID, _buoyancy);
@@ -618,7 +613,7 @@ public sealed class BSPrim : PhysicsActor
618 m_log.WarnFormat("{0}: Got a NaN force applied to a Character", LogHeader); 613 m_log.WarnFormat("{0}: Got a NaN force applied to a Character", LogHeader);
619 return; 614 return;
620 } 615 }
621 _scene.TaintedObject(delegate() 616 _scene.TaintedObject("BSPrim.AddForce", delegate()
622 { 617 {
623 OMV.Vector3 fSum = OMV.Vector3.Zero; 618 OMV.Vector3 fSum = OMV.Vector3.Zero;
624 lock (m_accumulatedForces) 619 lock (m_accumulatedForces)
@@ -648,7 +643,7 @@ public sealed class BSPrim : PhysicsActor
648 // make sure first collision happens 643 // make sure first collision happens
649 _nextCollisionOkTime = Util.EnvironmentTickCount() - _subscribedEventsMs; 644 _nextCollisionOkTime = Util.EnvironmentTickCount() - _subscribedEventsMs;
650 645
651 Scene.TaintedObject(delegate() 646 Scene.TaintedObject("BSPrim.SubscribeEvents", delegate()
652 { 647 {
653 BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 648 BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
654 }); 649 });
@@ -656,7 +651,7 @@ public sealed class BSPrim : PhysicsActor
656 } 651 }
657 public override void UnSubscribeEvents() { 652 public override void UnSubscribeEvents() {
658 _subscribedEventsMs = 0; 653 _subscribedEventsMs = 0;
659 Scene.TaintedObject(delegate() 654 Scene.TaintedObject("BSPrim.UnSubscribeEvents", delegate()
660 { 655 {
661 BulletSimAPI.RemoveFromCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 656 BulletSimAPI.RemoveFromCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
662 }); 657 });