aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
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
parentBulletSim: modify LIMIT_MOTOR_UP to limit BOAT types to be at water rather th... (diff)
downloadopensim-SC-63099184dbd2c1c5bcee2c3c87802f78444e7008.zip
opensim-SC-63099184dbd2c1c5bcee2c3c87802f78444e7008.tar.gz
opensim-SC-63099184dbd2c1c5bcee2c3c87802f78444e7008.tar.bz2
opensim-SC-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 'OpenSim/Region/Physics/BulletSPlugin')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSMotors.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs54
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt9
3 files changed, 45 insertions, 20 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
index 851d508..cf0a9dc 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
@@ -65,7 +65,7 @@ public abstract class BSMotor
65// Can all the incremental stepping be replaced with motor classes? 65// Can all the incremental stepping be replaced with motor classes?
66 66
67// Motor which moves CurrentValue to TargetValue over TimeScale seconds. 67// Motor which moves CurrentValue to TargetValue over TimeScale seconds.
68// The TargetValue is decays in TargetValueDecayTimeScale and 68// The TargetValue decays in TargetValueDecayTimeScale and
69// the CurrentValue will be held back by FrictionTimeScale. 69// the CurrentValue will be held back by FrictionTimeScale.
70// TimeScale and TargetDelayTimeScale may be 'infinite' which means go decay. 70// TimeScale and TargetDelayTimeScale may be 'infinite' which means go decay.
71 71
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
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index 4b6e9a4..1c7b577 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -11,12 +11,14 @@ CRASHES
11 11
12VEHICLES TODO LIST: 12VEHICLES TODO LIST:
13================================================= 13=================================================
14Neb car jiggling left and right 14Neb vehicle taking > 25ms of physics time!!
15 Happens on terrain and any other mesh object. Flat cubes are much smoother.
16Vehicles (Move smoothly) 15Vehicles (Move smoothly)
17Add vehicle collisions so IsColliding is properly reported. 16Add vehicle collisions so IsColliding is properly reported.
18 Needed for banking, limitMotorUp, movementLimiting, ... 17 Needed for banking, limitMotorUp, movementLimiting, ...
19Some vehicles should not be able to turn if no speed or off ground. 18Some vehicles should not be able to turn if no speed or off ground.
19Neb car jiggling left and right
20 Happens on terrain and any other mesh object. Flat cubes are much smoother.
21 This has been reduced but not eliminated.
20For limitMotorUp, use raycast down to find if vehicle is in the air. 22For limitMotorUp, use raycast down to find if vehicle is in the air.
21Implement function efficiency for lineaar and angular motion. 23Implement function efficiency for lineaar and angular motion.
22Should vehicle angular/linear movement friction happen after all the components 24Should vehicle angular/linear movement friction happen after all the components
@@ -30,6 +32,9 @@ Border crossing with linked vehicle causes crash
30 32
31BULLETSIM TODO LIST: 33BULLETSIM TODO LIST:
32================================================= 34=================================================
35Avatar height off after unsitting (float off ground)
36 Editting appearance then moving restores.
37 Must not be initializing height when recreating capsule after unsit.
33Duplicating a physical prim causes old prim to jump away 38Duplicating a physical prim causes old prim to jump away
34 Dup a phys prim and the original become unselected and thus interacts w/ selected prim. 39 Dup a phys prim and the original become unselected and thus interacts w/ selected prim.
35Disable activity of passive linkset children. 40Disable activity of passive linkset children.