aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
authorRobert Adams2012-12-16 21:18:32 -0800
committerRobert Adams2012-12-16 21:19:13 -0800
commit2b8efa24dd816fda23fe3aed5822af1d50febf5d (patch)
tree287352bc66cf34ce25ee86a59099af43d2d23cb4 /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
parentBulletSim: add even more to the TODO list. (diff)
downloadopensim-SC_OLD-2b8efa24dd816fda23fe3aed5822af1d50febf5d.zip
opensim-SC_OLD-2b8efa24dd816fda23fe3aed5822af1d50febf5d.tar.gz
opensim-SC_OLD-2b8efa24dd816fda23fe3aed5822af1d50febf5d.tar.bz2
opensim-SC_OLD-2b8efa24dd816fda23fe3aed5822af1d50febf5d.tar.xz
BulletSim: add parameter to UpdateProperties call into the linkset so changes from the physics engine can be differentiated from changes made by the user. This eliminates a linkset rebuild loop. Also add logic to not rebuild or freak out when the object/linkset crosses a terrain boundry.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs29
1 files changed, 21 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 53be2e3..758d92b 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -300,6 +300,10 @@ public sealed class BSPrim : BSPhysObject
300 } 300 }
301 _position = value; 301 _position = value;
302 PositionSanityCheck(false); 302 PositionSanityCheck(false);
303
304 // A linkset might need to know if a component information changed.
305 Linkset.UpdateProperties(this, false);
306
303 PhysicsScene.TaintedObject("BSPrim.setPosition", delegate() 307 PhysicsScene.TaintedObject("BSPrim.setPosition", delegate()
304 { 308 {
305 DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 309 DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
@@ -329,6 +333,14 @@ public sealed class BSPrim : BSPhysObject
329 { 333 {
330 bool ret = false; 334 bool ret = false;
331 335
336 if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(_position))
337 {
338 // The physical object is out of the known/simulated area.
339 // Upper levels of code will handle the transition to other areas so, for
340 // the time, we just ignore the position.
341 return ret;
342 }
343
332 float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(_position); 344 float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(_position);
333 OMV.Vector3 upForce = OMV.Vector3.Zero; 345 OMV.Vector3 upForce = OMV.Vector3.Zero;
334 if (RawPosition.Z < terrainHeight) 346 if (RawPosition.Z < terrainHeight)
@@ -352,8 +364,6 @@ public sealed class BSPrim : BSPhysObject
352 } 364 }
353 } 365 }
354 366
355 // TODO: check for out of bounds
356
357 // The above code computes a force to apply to correct any out-of-bounds problems. Apply same. 367 // The above code computes a force to apply to correct any out-of-bounds problems. Apply same.
358 // TODO: This should be intergrated with a geneal physics action mechanism. 368 // TODO: This should be intergrated with a geneal physics action mechanism.
359 // TODO: This should be moderated with PID'ness. 369 // TODO: This should be moderated with PID'ness.
@@ -567,7 +577,10 @@ public sealed class BSPrim : BSPhysObject
567 if (_orientation == value) 577 if (_orientation == value)
568 return; 578 return;
569 _orientation = value; 579 _orientation = value;
570 // TODO: what does it mean if a child in a linkset changes its orientation? Rebuild the constraint? 580
581 // A linkset might need to know if a component information changed.
582 Linkset.UpdateProperties(this, false);
583
571 PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate() 584 PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate()
572 { 585 {
573 if (PhysBody.HasPhysicalBody) 586 if (PhysBody.HasPhysicalBody)
@@ -1432,14 +1445,14 @@ public sealed class BSPrim : BSPhysObject
1432 entprop.Velocity = _velocity; 1445 entprop.Velocity = _velocity;
1433 } 1446 }
1434 1447
1435 // remember the current and last set values
1436 LastEntityProperties = CurrentEntityProperties;
1437 CurrentEntityProperties = entprop;
1438
1439 OMV.Vector3 direction = OMV.Vector3.UnitX * _orientation; // DEBUG DEBUG DEBUG 1448 OMV.Vector3 direction = OMV.Vector3.UnitX * _orientation; // DEBUG DEBUG DEBUG
1440 DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},dir={3},vel={4},rotVel={5}", 1449 DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},dir={3},vel={4},rotVel={5}",
1441 LocalID, _position, _orientation, direction, _velocity, _rotationalVelocity); 1450 LocalID, _position, _orientation, direction, _velocity, _rotationalVelocity);
1442 1451
1452 // remember the current and last set values
1453 LastEntityProperties = CurrentEntityProperties;
1454 CurrentEntityProperties = entprop;
1455
1443 base.RequestPhysicsterseUpdate(); 1456 base.RequestPhysicsterseUpdate();
1444 } 1457 }
1445 /* 1458 /*
@@ -1453,7 +1466,7 @@ public sealed class BSPrim : BSPhysObject
1453 */ 1466 */
1454 1467
1455 // The linkset implimentation might want to know about this. 1468 // The linkset implimentation might want to know about this.
1456 Linkset.UpdateProperties(this); 1469 Linkset.UpdateProperties(this, true);
1457 } 1470 }
1458} 1471}
1459} 1472}