aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
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
parentBulletSim: fix build break introduced by previous commit (diff)
downloadopensim-SC-c1371ab786a699ce91693e6e575bb81144a79c57.zip
opensim-SC-c1371ab786a699ce91693e6e575bb81144a79c57.tar.gz
opensim-SC-c1371ab786a699ce91693e6e575bb81144a79c57.tar.bz2
opensim-SC-c1371ab786a699ce91693e6e575bb81144a79c57.tar.xz
BulletSim: working on COM
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs19
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs7
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs15
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt2
4 files changed, 36 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
index bc163eb..2828cab 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
@@ -140,6 +140,25 @@ public struct EntityProperties
140 public Vector3 Velocity; 140 public Vector3 Velocity;
141 public Vector3 Acceleration; 141 public Vector3 Acceleration;
142 public Vector3 RotationalVelocity; 142 public Vector3 RotationalVelocity;
143
144 public override string ToString()
145 {
146 StringBuilder buff = new StringBuilder();
147 buff.Append("<i=");
148 buff.Append(ID.ToString());
149 buff.Append(",p=");
150 buff.Append(Position.ToString());
151 buff.Append(",r=");
152 buff.Append(Rotation.ToString());
153 buff.Append(",v=");
154 buff.Append(Velocity.ToString());
155 buff.Append(",a=");
156 buff.Append(Acceleration.ToString());
157 buff.Append(",rv=");
158 buff.Append(RotationalVelocity.ToString());
159 buff.Append(">");
160 return buff.ToString();
161 }
143} 162}
144 163
145// Format of this structure must match the definition in the C++ code 164// Format of this structure must match the definition in the C++ code
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 0077da7..d8e4028 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -377,7 +377,7 @@ public sealed class BSLinksetCompound : BSLinkset
377 // Constraint linksets are rebuilt every time. 377 // Constraint linksets are rebuilt every time.
378 // Note that this works for rebuilding just the root after a linkset is taken apart. 378 // Note that this works for rebuilding just the root after a linkset is taken apart.
379 // Called at taint time!! 379 // Called at taint time!!
380 private bool disableCOM = true; // disable until we get this debugged 380 private bool disableCOM = false; // disable until we get this debugged
381 private void RecomputeLinksetCompound() 381 private void RecomputeLinksetCompound()
382 { 382 {
383 try 383 try
@@ -400,8 +400,9 @@ public sealed class BSLinksetCompound : BSLinkset
400 } // DEBUG DEBUG 400 } // DEBUG DEBUG
401 else 401 else
402 { 402 {
403 centerOfMass = ComputeLinksetGeometricCenter(); 403 centerOfMass = ComputeLinksetCenterOfMass();
404 centerDisplacement = centerOfMass - LinksetRoot.RawPosition; 404 // 'centerDisplacement' is the value to *add* to all the shape offsets
405 centerDisplacement = LinksetRoot.RawPosition - centerOfMass;
405 406
406 // Since we're displacing the center of the shape, we need to move the body in the world 407 // Since we're displacing the center of the shape, we need to move the body in the world
407 LinksetRoot.PositionDisplacement = centerDisplacement; 408 LinksetRoot.PositionDisplacement = centerDisplacement;
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;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index 41bab26..801f690 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -1,5 +1,7 @@
1CURRENT PRIORITIES 1CURRENT PRIORITIES
2================================================= 2=================================================
3Deleting a linkset while standing on the root will leave the physical shape of the root behind.
4 Not sure if it is because standing on it. Done with large prim linksets.
3Child movement in linkset (don't rebuild linkset) 5Child movement in linkset (don't rebuild linkset)
4Vehicle angular vertical attraction 6Vehicle angular vertical attraction
5vehicle angular banking 7vehicle angular banking