aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
authorRobert Adams2013-01-23 08:28:36 -0800
committerRobert Adams2013-01-23 14:25:06 -0800
commitc1371ab786a699ce91693e6e575bb81144a79c57 (patch)
tree4ca77ded358520a3ca7f962a89cd544fc001f245 /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
parentBulletSim: fix build break introduced by previous commit (diff)
downloadopensim-SC_OLD-c1371ab786a699ce91693e6e575bb81144a79c57.zip
opensim-SC_OLD-c1371ab786a699ce91693e6e575bb81144a79c57.tar.gz
opensim-SC_OLD-c1371ab786a699ce91693e6e575bb81144a79c57.tar.bz2
opensim-SC_OLD-c1371ab786a699ce91693e6e575bb81144a79c57.tar.xz
BulletSim: working on COM
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs15
1 files changed, 11 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index b37a1f8..dad7250 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -336,6 +336,7 @@ public sealed class BSPrim : BSPhysObject
336 } 336 }
337 } 337 }
338 } 338 }
339 /* Disable. Presume whoever is setting displacement is already adjusting position, etc.
339 // Override to have position displacement immediately update the physical position. 340 // Override to have position displacement immediately update the physical position.
340 // A feeble attempt to keep the sim and physical positions in sync 341 // A feeble attempt to keep the sim and physical positions in sync
341 // Must be called at taint time. 342 // Must be called at taint time.
@@ -355,6 +356,7 @@ public sealed class BSPrim : BSPhysObject
355 }); 356 });
356 } 357 }
357 } 358 }
359 */
358 360
359 // Check that the current position is sane and, if not, modify the position to make it so. 361 // Check that the current position is sane and, if not, modify the position to make it so.
360 // Check for being below terrain and being out of bounds. 362 // Check for being below terrain and being out of bounds.
@@ -371,11 +373,11 @@ public sealed class BSPrim : BSPhysObject
371 return ret; 373 return ret;
372 } 374 }
373 375
374 float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(_position); 376 float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(RawPosition);
375 OMV.Vector3 upForce = OMV.Vector3.Zero; 377 OMV.Vector3 upForce = OMV.Vector3.Zero;
376 if (RawPosition.Z < terrainHeight) 378 if (RawPosition.Z < terrainHeight)
377 { 379 {
378 DetailLog("{0},BSPrim.PositionAdjustUnderGround,call,pos={1},terrain={2}", LocalID, _position, terrainHeight); 380 DetailLog("{0},BSPrim.PositionAdjustUnderGround,call,pos={1},terrain={2}", LocalID, RawPosition, terrainHeight);
379 float targetHeight = terrainHeight + (Size.Z / 2f); 381 float targetHeight = terrainHeight + (Size.Z / 2f);
380 // If the object is below ground it just has to be moved up because pushing will 382 // If the object is below ground it just has to be moved up because pushing will
381 // not get it through the terrain 383 // not get it through the terrain
@@ -1637,7 +1639,11 @@ public sealed class BSPrim : BSPhysObject
1637 // entprop.RotationalVelocity = OMV.Vector3.Zero; 1639 // entprop.RotationalVelocity = OMV.Vector3.Zero;
1638 } 1640 }
1639 1641
1642 DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG
1643
1640 // Assign directly to the local variables so the normal set actions do not happen 1644 // Assign directly to the local variables so the normal set actions do not happen
1645
1646 // Undo any center-of-mass displacement that might have been done.
1641 entprop.Position -= PositionDisplacement; 1647 entprop.Position -= PositionDisplacement;
1642 _position = entprop.Position; 1648 _position = entprop.Position;
1643 _orientation = entprop.Rotation; 1649 _orientation = entprop.Rotation;
@@ -1645,6 +1651,8 @@ public sealed class BSPrim : BSPhysObject
1645 _acceleration = entprop.Acceleration; 1651 _acceleration = entprop.Acceleration;
1646 _rotationalVelocity = entprop.RotationalVelocity; 1652 _rotationalVelocity = entprop.RotationalVelocity;
1647 1653
1654 DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG
1655
1648 // The sanity check can change the velocity and/or position. 1656 // The sanity check can change the velocity and/or position.
1649 if (IsPhysical && PositionSanityCheck(true)) 1657 if (IsPhysical && PositionSanityCheck(true))
1650 { 1658 {
@@ -1653,8 +1661,7 @@ public sealed class BSPrim : BSPhysObject
1653 } 1661 }
1654 1662
1655 OMV.Vector3 direction = OMV.Vector3.UnitX * _orientation; // DEBUG DEBUG DEBUG 1663 OMV.Vector3 direction = OMV.Vector3.UnitX * _orientation; // DEBUG DEBUG DEBUG
1656 DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},dir={3},vel={4},rotVel={5}", 1664 DetailLog("{0},BSPrim.UpdateProperties,call,entProp={1},dir={2}", LocalID, entprop, direction);
1657 LocalID, _position, _orientation, direction, _velocity, _rotationalVelocity);
1658 1665
1659 // remember the current and last set values 1666 // remember the current and last set values
1660 LastEntityProperties = CurrentEntityProperties; 1667 LastEntityProperties = CurrentEntityProperties;