aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorRobert Adams2012-12-11 13:54:26 -0800
committerRobert Adams2012-12-11 13:54:26 -0800
commitd4e0e98c001c3501ac17849ab78e7ac5a59a5c26 (patch)
tree719a678224bd1a5787222889eeba10675238482f /OpenSim/Region/Physics
parentBulletSim: protect prim property setting to remove crash from taints setting ... (diff)
downloadopensim-SC_OLD-d4e0e98c001c3501ac17849ab78e7ac5a59a5c26.zip
opensim-SC_OLD-d4e0e98c001c3501ac17849ab78e7ac5a59a5c26.tar.gz
opensim-SC_OLD-d4e0e98c001c3501ac17849ab78e7ac5a59a5c26.tar.bz2
opensim-SC_OLD-d4e0e98c001c3501ac17849ab78e7ac5a59a5c26.tar.xz
BulletSim: protect character property setting to remove crash from taints setting properties after the destroy character taint.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs60
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs3
2 files changed, 42 insertions, 21 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 88460cc..83c78f6 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -196,8 +196,11 @@ public sealed class BSCharacter : BSPhysObject
196 196
197 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate() 197 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate()
198 { 198 {
199 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); 199 if (PhysShape.HasPhysicalShape)
200 UpdatePhysicalMassProperties(RawMass); 200 {
201 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale);
202 UpdatePhysicalMassProperties(RawMass);
203 }
201 }); 204 });
202 205
203 } 206 }
@@ -238,7 +241,8 @@ public sealed class BSCharacter : BSPhysObject
238 // Zero some other properties directly into the physics engine 241 // Zero some other properties directly into the physics engine
239 PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate() 242 PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate()
240 { 243 {
241 BulletSimAPI.ClearAllForces2(PhysBody.ptr); 244 if (PhysBody.HasPhysicalBody)
245 BulletSimAPI.ClearAllForces2(PhysBody.ptr);
242 }); 246 });
243 } 247 }
244 public override void ZeroAngularMotion(bool inTaintTime) 248 public override void ZeroAngularMotion(bool inTaintTime)
@@ -247,10 +251,13 @@ public sealed class BSCharacter : BSPhysObject
247 251
248 PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate() 252 PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate()
249 { 253 {
250 BulletSimAPI.SetInterpolationAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero); 254 if (PhysBody.HasPhysicalBody)
251 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero); 255 {
252 // The next also get rid of applied linear force but the linear velocity is untouched. 256 BulletSimAPI.SetInterpolationAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero);
253 BulletSimAPI.ClearForces2(PhysBody.ptr); 257 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero);
258 // The next also get rid of applied linear force but the linear velocity is untouched.
259 BulletSimAPI.ClearForces2(PhysBody.ptr);
260 }
254 }); 261 });
255 } 262 }
256 263
@@ -275,7 +282,8 @@ public sealed class BSCharacter : BSPhysObject
275 PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate() 282 PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate()
276 { 283 {
277 DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 284 DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
278 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 285 if (PhysBody.HasPhysicalBody)
286 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
279 }); 287 });
280 } 288 }
281 } 289 }
@@ -334,7 +342,8 @@ public sealed class BSCharacter : BSPhysObject
334 PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate() 342 PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate()
335 { 343 {
336 DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); 344 DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation);
337 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 345 if (PhysBody.HasPhysicalBody)
346 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
338 }); 347 });
339 ret = true; 348 ret = true;
340 } 349 }
@@ -361,7 +370,8 @@ public sealed class BSCharacter : BSPhysObject
361 PhysicsScene.TaintedObject("BSCharacter.SetForce", delegate() 370 PhysicsScene.TaintedObject("BSCharacter.SetForce", delegate()
362 { 371 {
363 DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, _force); 372 DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, _force);
364 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force); 373 if (PhysBody.HasPhysicalBody)
374 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force);
365 }); 375 });
366 } 376 }
367 } 377 }
@@ -400,7 +410,8 @@ public sealed class BSCharacter : BSPhysObject
400 if (_currentFriction != PhysicsScene.Params.avatarStandingFriction) 410 if (_currentFriction != PhysicsScene.Params.avatarStandingFriction)
401 { 411 {
402 _currentFriction = PhysicsScene.Params.avatarStandingFriction; 412 _currentFriction = PhysicsScene.Params.avatarStandingFriction;
403 BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction); 413 if (PhysBody.HasPhysicalBody)
414 BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction);
404 } 415 }
405 } 416 }
406 else 417 else
@@ -408,7 +419,8 @@ public sealed class BSCharacter : BSPhysObject
408 if (_currentFriction != PhysicsScene.Params.avatarFriction) 419 if (_currentFriction != PhysicsScene.Params.avatarFriction)
409 { 420 {
410 _currentFriction = PhysicsScene.Params.avatarFriction; 421 _currentFriction = PhysicsScene.Params.avatarFriction;
411 BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction); 422 if (PhysBody.HasPhysicalBody)
423 BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction);
412 } 424 }
413 } 425 }
414 _velocity = value; 426 _velocity = value;
@@ -445,8 +457,11 @@ public sealed class BSCharacter : BSPhysObject
445 // m_log.DebugFormat("{0}: set orientation to {1}", LogHeader, _orientation); 457 // m_log.DebugFormat("{0}: set orientation to {1}", LogHeader, _orientation);
446 PhysicsScene.TaintedObject("BSCharacter.setOrientation", delegate() 458 PhysicsScene.TaintedObject("BSCharacter.setOrientation", delegate()
447 { 459 {
448 // _position = BulletSimAPI.GetPosition2(BSBody.ptr); 460 if (PhysBody.HasPhysicalBody)
449 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 461 {
462 // _position = BulletSimAPI.GetPosition2(BSBody.ptr);
463 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
464 }
450 }); 465 });
451 } 466 }
452 } 467 }
@@ -519,10 +534,13 @@ public sealed class BSCharacter : BSPhysObject
519 _floatOnWater = value; 534 _floatOnWater = value;
520 PhysicsScene.TaintedObject("BSCharacter.setFloatOnWater", delegate() 535 PhysicsScene.TaintedObject("BSCharacter.setFloatOnWater", delegate()
521 { 536 {
522 if (_floatOnWater) 537 if (PhysBody.HasPhysicalBody)
523 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 538 {
524 else 539 if (_floatOnWater)
525 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 540 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER);
541 else
542 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER);
543 }
526 }); 544 });
527 } 545 }
528 } 546 }
@@ -555,7 +573,8 @@ public sealed class BSCharacter : BSPhysObject
555 DetailLog("{0},BSCharacter.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); 573 DetailLog("{0},BSCharacter.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
556 // Buoyancy is faked by changing the gravity applied to the object 574 // Buoyancy is faked by changing the gravity applied to the object
557 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); 575 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy);
558 BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav)); 576 if (PhysBody.HasPhysicalBody)
577 BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav));
559 } 578 }
560 } 579 }
561 580
@@ -601,7 +620,8 @@ public sealed class BSCharacter : BSPhysObject
601 PhysicsScene.TaintedObject("BSCharacter.AddForce", delegate() 620 PhysicsScene.TaintedObject("BSCharacter.AddForce", delegate()
602 { 621 {
603 DetailLog("{0},BSCharacter.setAddForce,taint,addedForce={1}", LocalID, _force); 622 DetailLog("{0},BSCharacter.setAddForce,taint,addedForce={1}", LocalID, _force);
604 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force); 623 if (PhysBody.HasPhysicalBody)
624 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force);
605 }); 625 });
606 } 626 }
607 else 627 else
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 1280c25..446e44c 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -191,7 +191,8 @@ public sealed class BSPrim : BSPhysObject
191 } 191 }
192 } 192 }
193 public override bool Selected { 193 public override bool Selected {
194 set { 194 set
195 {
195 if (value != _isSelected) 196 if (value != _isSelected)
196 { 197 {
197 _isSelected = value; 198 _isSelected = value;