aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
authorRobert Adams2012-12-11 13:42:23 -0800
committerRobert Adams2012-12-11 13:42:23 -0800
commit63099184dbd2c1c5bcee2c3c87802f78444e7008 (patch)
tree936dabfe362cda626a6e51a9e547bc7e7521fc6c /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
parentBulletSim: modify LIMIT_MOTOR_UP to limit BOAT types to be at water rather th... (diff)
downloadopensim-SC_OLD-63099184dbd2c1c5bcee2c3c87802f78444e7008.zip
opensim-SC_OLD-63099184dbd2c1c5bcee2c3c87802f78444e7008.tar.gz
opensim-SC_OLD-63099184dbd2c1c5bcee2c3c87802f78444e7008.tar.bz2
opensim-SC_OLD-63099184dbd2c1c5bcee2c3c87802f78444e7008.tar.xz
BulletSim: protect prim property setting to remove crash from taints setting properties after the destroy object taint has happened.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs54
1 files changed, 37 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index d1d100d..1280c25 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -249,7 +249,8 @@ public sealed class BSPrim : BSPhysObject
249 // Zero some other properties in the physics engine 249 // Zero some other properties in the physics engine
250 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate() 250 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate()
251 { 251 {
252 BulletSimAPI.ClearAllForces2(PhysBody.ptr); 252 if (PhysBody.HasPhysicalBody)
253 BulletSimAPI.ClearAllForces2(PhysBody.ptr);
253 }); 254 });
254 } 255 }
255 public override void ZeroAngularMotion(bool inTaintTime) 256 public override void ZeroAngularMotion(bool inTaintTime)
@@ -259,8 +260,11 @@ public sealed class BSPrim : BSPhysObject
259 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate() 260 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate()
260 { 261 {
261 // DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity); 262 // DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity);
262 BulletSimAPI.SetInterpolationAngularVelocity2(PhysBody.ptr, _rotationalVelocity); 263 if (PhysBody.HasPhysicalBody)
263 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity); 264 {
265 BulletSimAPI.SetInterpolationAngularVelocity2(PhysBody.ptr, _rotationalVelocity);
266 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity);
267 }
264 }); 268 });
265 } 269 }
266 270
@@ -297,8 +301,11 @@ public sealed class BSPrim : BSPhysObject
297 PhysicsScene.TaintedObject("BSPrim.setPosition", delegate() 301 PhysicsScene.TaintedObject("BSPrim.setPosition", delegate()
298 { 302 {
299 // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 303 // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
300 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 304 if (PhysBody.HasPhysicalBody)
301 ActivateIfPhysical(false); 305 {
306 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
307 ActivateIfPhysical(false);
308 }
302 }); 309 });
303 } 310 }
304 } 311 }
@@ -415,7 +422,8 @@ public sealed class BSPrim : BSPhysObject
415 PhysicsScene.TaintedObject("BSPrim.setForce", delegate() 422 PhysicsScene.TaintedObject("BSPrim.setForce", delegate()
416 { 423 {
417 // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); 424 // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force);
418 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force); 425 if (PhysBody.HasPhysicalBody)
426 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force);
419 }); 427 });
420 } 428 }
421 } 429 }
@@ -509,7 +517,8 @@ public sealed class BSPrim : BSPhysObject
509 PhysicsScene.TaintedObject("BSPrim.setVelocity", delegate() 517 PhysicsScene.TaintedObject("BSPrim.setVelocity", delegate()
510 { 518 {
511 // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity); 519 // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity);
512 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity); 520 if (PhysBody.HasPhysicalBody)
521 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity);
513 }); 522 });
514 } 523 }
515 } 524 }
@@ -558,9 +567,12 @@ public sealed class BSPrim : BSPhysObject
558 // TODO: what does it mean if a child in a linkset changes its orientation? Rebuild the constraint? 567 // TODO: what does it mean if a child in a linkset changes its orientation? Rebuild the constraint?
559 PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate() 568 PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate()
560 { 569 {
561 // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); 570 if (PhysBody.HasPhysicalBody)
562 // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); 571 {
563 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 572 // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr);
573 // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation);
574 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
575 }
564 }); 576 });
565 } 577 }
566 } 578 }
@@ -865,7 +877,8 @@ public sealed class BSPrim : BSPhysObject
865 PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() 877 PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate()
866 { 878 {
867 DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); 879 DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity);
868 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity); 880 if (PhysBody.HasPhysicalBody)
881 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity);
869 }); 882 });
870 } 883 }
871 } 884 }
@@ -900,8 +913,11 @@ public sealed class BSPrim : BSPhysObject
900 _buoyancy = value; 913 _buoyancy = value;
901 // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); 914 // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
902 // Buoyancy is faked by changing the gravity applied to the object 915 // Buoyancy is faked by changing the gravity applied to the object
903 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); 916 if (PhysBody.HasPhysicalBody)
904 BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav)); 917 {
918 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy);
919 BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav));
920 }
905 } 921 }
906 } 922 }
907 923
@@ -969,7 +985,8 @@ public sealed class BSPrim : BSPhysObject
969 } 985 }
970 DetailLog("{0},BSPrim.AddForce,taint,force={1}", LocalID, fSum); 986 DetailLog("{0},BSPrim.AddForce,taint,force={1}", LocalID, fSum);
971 if (fSum != OMV.Vector3.Zero) 987 if (fSum != OMV.Vector3.Zero)
972 BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, fSum); 988 if (PhysBody.HasPhysicalBody)
989 BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, fSum);
973 }); 990 });
974 } 991 }
975 992
@@ -980,7 +997,8 @@ public sealed class BSPrim : BSPhysObject
980 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyForceImpulse", delegate() 997 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyForceImpulse", delegate()
981 { 998 {
982 DetailLog("{0},BSPrim.ApplyForceImpulse,taint,tImpulse={1}", LocalID, applyImpulse); 999 DetailLog("{0},BSPrim.ApplyForceImpulse,taint,tImpulse={1}", LocalID, applyImpulse);
983 BulletSimAPI.ApplyCentralImpulse2(PhysBody.ptr, applyImpulse); 1000 if (PhysBody.HasPhysicalBody)
1001 BulletSimAPI.ApplyCentralImpulse2(PhysBody.ptr, applyImpulse);
984 }); 1002 });
985 } 1003 }
986 1004
@@ -1016,7 +1034,8 @@ public sealed class BSPrim : BSPhysObject
1016 DetailLog("{0},BSPrim.AddAngularForce,taint,aForce={1}", LocalID, fSum); 1034 DetailLog("{0},BSPrim.AddAngularForce,taint,aForce={1}", LocalID, fSum);
1017 if (fSum != OMV.Vector3.Zero) 1035 if (fSum != OMV.Vector3.Zero)
1018 { 1036 {
1019 BulletSimAPI.ApplyTorque2(PhysBody.ptr, fSum); 1037 if (PhysBody.HasPhysicalBody)
1038 BulletSimAPI.ApplyTorque2(PhysBody.ptr, fSum);
1020 _torque = fSum; 1039 _torque = fSum;
1021 } 1040 }
1022 }); 1041 });
@@ -1030,7 +1049,8 @@ public sealed class BSPrim : BSPhysObject
1030 OMV.Vector3 applyImpulse = impulse; 1049 OMV.Vector3 applyImpulse = impulse;
1031 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyTorqueImpulse", delegate() 1050 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyTorqueImpulse", delegate()
1032 { 1051 {
1033 BulletSimAPI.ApplyTorqueImpulse2(PhysBody.ptr, applyImpulse); 1052 if (PhysBody.HasPhysicalBody)
1053 BulletSimAPI.ApplyTorqueImpulse2(PhysBody.ptr, applyImpulse);
1034 }); 1054 });
1035 } 1055 }
1036 1056