aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs19
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs66
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs5
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs19
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs8
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs7
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs60
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt2
9 files changed, 83 insertions, 107 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/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index dbe44de..fe7891e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -690,7 +690,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
690 // Bullet does a bunch of smoothing for changing parameters. 690 // Bullet does a bunch of smoothing for changing parameters.
691 // Since the vehicle is demanding this setting, we override Bullet's smoothing 691 // Since the vehicle is demanding this setting, we override Bullet's smoothing
692 // by telling Bullet the value was the same last time. 692 // by telling Bullet the value was the same last time.
693 PhysicsScene.PE.SetInterpolationLinearVelocity(Prim.PhysBody, m_knownVelocity); 693 // PhysicsScene.PE.SetInterpolationLinearVelocity(Prim.PhysBody, m_knownVelocity);
694 } 694 }
695 695
696 if ((m_knownChanged & m_knownChangedForce) != 0) 696 if ((m_knownChanged & m_knownChangedForce) != 0)
@@ -702,7 +702,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
702 if ((m_knownChanged & m_knownChangedRotationalVelocity) != 0) 702 if ((m_knownChanged & m_knownChangedRotationalVelocity) != 0)
703 { 703 {
704 Prim.ForceRotationalVelocity = m_knownRotationalVelocity; 704 Prim.ForceRotationalVelocity = m_knownRotationalVelocity;
705 PhysicsScene.PE.SetInterpolationAngularVelocity(Prim.PhysBody, m_knownRotationalVelocity); 705 // PhysicsScene.PE.SetInterpolationAngularVelocity(Prim.PhysBody, m_knownRotationalVelocity);
706 } 706 }
707 707
708 if ((m_knownChanged & m_knownChangedRotationalImpulse) != 0) 708 if ((m_knownChanged & m_knownChangedRotationalImpulse) != 0)
@@ -963,23 +963,23 @@ namespace OpenSim.Region.Physics.BulletSPlugin
963 { 963 {
964 // Step the motor from the current value. Get the correction needed this step. 964 // Step the motor from the current value. Get the correction needed this step.
965 Vector3 currentVel = VehicleVelocity * Quaternion.Inverse(VehicleOrientation); 965 Vector3 currentVel = VehicleVelocity * Quaternion.Inverse(VehicleOrientation);
966 Vector3 linearMotorCorrection = m_linearMotor.Step(pTimestep, currentVel); 966 Vector3 linearMotorCorrectionV = m_linearMotor.Step(pTimestep, currentVel);
967 967
968 // Motor is vehicle coordinates. Rotate it to world coordinates 968 // Motor is vehicle coordinates. Rotate it to world coordinates
969 Vector3 linearMotorVelocity = linearMotorCorrection * VehicleOrientation; 969 Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation;
970 970
971 // If we're a ground vehicle, don't add any upward Z movement 971 // If we're a ground vehicle, don't add any upward Z movement
972 if ((m_flags & VehicleFlag.LIMIT_MOTOR_UP) != 0) 972 if ((m_flags & VehicleFlag.LIMIT_MOTOR_UP) != 0)
973 { 973 {
974 if (linearMotorVelocity.Z > 0f) 974 if (linearMotorVelocityW.Z > 0f)
975 linearMotorVelocity.Z = 0f; 975 linearMotorVelocityW.Z = 0f;
976 } 976 }
977 977
978 // Add this correction to the velocity to make it faster/slower. 978 // Add this correction to the velocity to make it faster/slower.
979 VehicleVelocity += linearMotorVelocity; 979 VehicleVelocity += linearMotorVelocityW;
980 980
981 VDetailLog("{0}, MoveLinear,velocity,vehVel={1},correction={2},force={3}", 981 VDetailLog("{0}, MoveLinear,velocity,vehVel={1},correction={2},force={3}",
982 Prim.LocalID, VehicleVelocity, linearMotorCorrection, linearMotorVelocity); 982 Prim.LocalID, VehicleVelocity, linearMotorCorrectionV, linearMotorVelocityW);
983 } 983 }
984 984
985 public void ComputeLinearTerrainHeightCorrection(float pTimestep) 985 public void ComputeLinearTerrainHeightCorrection(float pTimestep)
@@ -1123,8 +1123,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1123 // a downward raycast to find what is below. 1123 // a downward raycast to find what is below.
1124 public void ComputeLinearMotorUp(float pTimestep) 1124 public void ComputeLinearMotorUp(float pTimestep)
1125 { 1125 {
1126 Vector3 ret = Vector3.Zero;
1127
1128 if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0) 1126 if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0)
1129 { 1127 {
1130 // This code tries to decide if the object is not on the ground and then pushing down 1128 // This code tries to decide if the object is not on the ground and then pushing down
@@ -1250,8 +1248,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1250 private void ComputeAngularTurning(float pTimestep) 1248 private void ComputeAngularTurning(float pTimestep)
1251 { 1249 {
1252 // The user wants this many radians per second angular change? 1250 // The user wants this many radians per second angular change?
1253 Vector3 currentAngular = VehicleRotationalVelocity * Quaternion.Inverse(VehicleOrientation); 1251 Vector3 currentAngularV = VehicleRotationalVelocity * Quaternion.Inverse(VehicleOrientation);
1254 Vector3 angularMotorContribution = m_angularMotor.Step(pTimestep, currentAngular); 1252 Vector3 angularMotorContributionV = m_angularMotor.Step(pTimestep, currentAngularV);
1255 1253
1256 // ================================================================== 1254 // ==================================================================
1257 // From http://wiki.secondlife.com/wiki/LlSetVehicleFlags : 1255 // From http://wiki.secondlife.com/wiki/LlSetVehicleFlags :
@@ -1263,12 +1261,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1263 // is a linear effect. Where should this check go? 1261 // is a linear effect. Where should this check go?
1264 if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0) 1262 if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0)
1265 { 1263 {
1266 angularMotorContribution.X = 0f; 1264 angularMotorContributionV.X = 0f;
1267 angularMotorContribution.Y = 0f; 1265 angularMotorContributionV.Y = 0f;
1268 } 1266 }
1269 1267
1270 VehicleRotationalVelocity += angularMotorContribution * VehicleOrientation; 1268 VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation;
1271 VDetailLog("{0}, MoveAngular,angularTurning,angularMotorContrib={1}", Prim.LocalID, angularMotorContribution); 1269 VDetailLog("{0}, MoveAngular,angularTurning,angularMotorContrib={1}", Prim.LocalID, angularMotorContributionV);
1272 } 1270 }
1273 1271
1274 // From http://wiki.secondlife.com/wiki/Linden_Vehicle_Tutorial: 1272 // From http://wiki.secondlife.com/wiki/Linden_Vehicle_Tutorial:
@@ -1284,7 +1282,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1284 // If vertical attaction timescale is reasonable 1282 // If vertical attaction timescale is reasonable
1285 if (enableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff) 1283 if (enableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff)
1286 { 1284 {
1287 Vector3 vertContribution = Vector3.Zero; 1285 Vector3 vertContributionV = Vector3.Zero;
1288 1286
1289 // Take a vector pointing up and convert it from world to vehicle relative coords. 1287 // Take a vector pointing up and convert it from world to vehicle relative coords.
1290 Vector3 verticalError = Vector3.UnitZ * VehicleOrientation; 1288 Vector3 verticalError = Vector3.UnitZ * VehicleOrientation;
@@ -1299,26 +1297,26 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1299 1297
1300 // Y error means needed rotation around X axis and visa versa. 1298 // Y error means needed rotation around X axis and visa versa.
1301 // Since the error goes from zero to one, the asin is the corresponding angle. 1299 // Since the error goes from zero to one, the asin is the corresponding angle.
1302 vertContribution.X = (float)Math.Asin(verticalError.Y); 1300 vertContributionV.X = (float)Math.Asin(verticalError.Y);
1303 // (Tilt forward (positive X) needs to tilt back (rotate negative) around Y axis.) 1301 // (Tilt forward (positive X) needs to tilt back (rotate negative) around Y axis.)
1304 vertContribution.Y = -(float)Math.Asin(verticalError.X); 1302 vertContributionV.Y = -(float)Math.Asin(verticalError.X);
1305 1303
1306 // If verticalError.Z is negative, the vehicle is upside down. Add additional push. 1304 // If verticalError.Z is negative, the vehicle is upside down. Add additional push.
1307 if (verticalError.Z < 0f) 1305 if (verticalError.Z < 0f)
1308 { 1306 {
1309 vertContribution.X += PIOverFour; 1307 vertContributionV.X += PIOverFour;
1310 // vertContribution.Y -= PIOverFour; 1308 // vertContribution.Y -= PIOverFour;
1311 } 1309 }
1312 1310
1313 // 'vertContrbution' is now the necessary angular correction to correct tilt in one second. 1311 // 'vertContrbution' is now the necessary angular correction to correct tilt in one second.
1314 // Correction happens over a number of seconds. 1312 // Correction happens over a number of seconds.
1315 Vector3 unscaledContrib = vertContribution; // DEBUG DEBUG 1313 Vector3 unscaledContrib = vertContributionV; // DEBUG DEBUG
1316 vertContribution /= m_verticalAttractionTimescale; 1314 vertContributionV /= m_verticalAttractionTimescale;
1317 1315
1318 VehicleRotationalVelocity += vertContribution * VehicleOrientation; 1316 VehicleRotationalVelocity += vertContributionV * VehicleOrientation;
1319 1317
1320 VDetailLog("{0}, MoveAngular,verticalAttraction,,verticalError={1},unscaled={2},eff={3},ts={4},vertAttr={5}", 1318 VDetailLog("{0}, MoveAngular,verticalAttraction,,verticalError={1},unscaled={2},eff={3},ts={4},vertAttr={5}",
1321 Prim.LocalID, verticalError, unscaledContrib, m_verticalAttractionEfficiency, m_verticalAttractionTimescale, vertContribution); 1319 Prim.LocalID, verticalError, unscaledContrib, m_verticalAttractionEfficiency, m_verticalAttractionTimescale, vertContributionV);
1322 } 1320 }
1323 } 1321 }
1324 1322
@@ -1336,7 +1334,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1336 1334
1337 if (enableAngularDeflection && m_angularDeflectionEfficiency != 0 && VehicleForwardSpeed > 0.2) 1335 if (enableAngularDeflection && m_angularDeflectionEfficiency != 0 && VehicleForwardSpeed > 0.2)
1338 { 1336 {
1339 Vector3 deflectContribution = Vector3.Zero; 1337 Vector3 deflectContributionV = Vector3.Zero;
1340 1338
1341 // The direction the vehicle is moving 1339 // The direction the vehicle is moving
1342 Vector3 movingDirection = VehicleVelocity; 1340 Vector3 movingDirection = VehicleVelocity;
@@ -1363,13 +1361,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1363 // ret = m_angularDeflectionCorrectionMotor(1f, deflectionError); 1361 // ret = m_angularDeflectionCorrectionMotor(1f, deflectionError);
1364 1362
1365 // Scale the correction by recovery timescale and efficiency 1363 // Scale the correction by recovery timescale and efficiency
1366 deflectContribution = (-deflectionError) * m_angularDeflectionEfficiency; 1364 deflectContributionV = (-deflectionError) * m_angularDeflectionEfficiency;
1367 deflectContribution /= m_angularDeflectionTimescale; 1365 deflectContributionV /= m_angularDeflectionTimescale;
1368 1366
1369 VehicleRotationalVelocity += deflectContribution * VehicleOrientation; 1367 VehicleRotationalVelocity += deflectContributionV * VehicleOrientation;
1370 1368
1371 VDetailLog("{0}, MoveAngular,Deflection,movingDir={1},pointingDir={2},deflectError={3},ret={4}", 1369 VDetailLog("{0}, MoveAngular,Deflection,movingDir={1},pointingDir={2},deflectError={3},ret={4}",
1372 Prim.LocalID, movingDirection, pointingDirection, deflectionError, deflectContribution); 1370 Prim.LocalID, movingDirection, pointingDirection, deflectionError, deflectContributionV);
1373 VDetailLog("{0}, MoveAngular,Deflection,fwdSpd={1},defEff={2},defTS={3}", 1371 VDetailLog("{0}, MoveAngular,Deflection,fwdSpd={1},defEff={2},defTS={3}",
1374 Prim.LocalID, VehicleForwardSpeed, m_angularDeflectionEfficiency, m_angularDeflectionTimescale); 1372 Prim.LocalID, VehicleForwardSpeed, m_angularDeflectionEfficiency, m_angularDeflectionTimescale);
1375 } 1373 }
@@ -1410,7 +1408,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1410 { 1408 {
1411 if (enableAngularBanking && m_bankingEfficiency != 0 && m_verticalAttractionTimescale < m_verticalAttractionCutoff) 1409 if (enableAngularBanking && m_bankingEfficiency != 0 && m_verticalAttractionTimescale < m_verticalAttractionCutoff)
1412 { 1410 {
1413 Vector3 bankingContribution = Vector3.Zero; 1411 Vector3 bankingContributionV = Vector3.Zero;
1414 1412
1415 // Rotate a UnitZ vector (pointing up) to how the vehicle is oriented. 1413 // Rotate a UnitZ vector (pointing up) to how the vehicle is oriented.
1416 // As the vehicle rolls to the right or left, the Y value will increase from 1414 // As the vehicle rolls to the right or left, the Y value will increase from
@@ -1428,15 +1426,15 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1428 mixedYawAngle = ClampInRange(-20f, mixedYawAngle, 20f); 1426 mixedYawAngle = ClampInRange(-20f, mixedYawAngle, 20f);
1429 1427
1430 // Build the force vector to change rotation from what it is to what it should be 1428 // Build the force vector to change rotation from what it is to what it should be
1431 bankingContribution.Z = -mixedYawAngle; 1429 bankingContributionV.Z = -mixedYawAngle;
1432 1430
1433 // Don't do it all at once. 1431 // Don't do it all at once.
1434 bankingContribution /= m_bankingTimescale; 1432 bankingContributionV /= m_bankingTimescale;
1435 1433
1436 VehicleRotationalVelocity += bankingContribution * VehicleOrientation; 1434 VehicleRotationalVelocity += bankingContributionV * VehicleOrientation;
1437 1435
1438 VDetailLog("{0}, MoveAngular,Banking,rollComp={1},speed={2},rollComp={3},yAng={4},mYAng={5},ret={6}", 1436 VDetailLog("{0}, MoveAngular,Banking,rollComp={1},speed={2},rollComp={3},yAng={4},mYAng={5},ret={6}",
1439 Prim.LocalID, rollComponents, VehicleForwardSpeed, rollComponents, yawAngle, mixedYawAngle, bankingContribution); 1437 Prim.LocalID, rollComponents, VehicleForwardSpeed, rollComponents, yawAngle, mixedYawAngle, bankingContributionV);
1440 } 1438 }
1441 } 1439 }
1442 1440
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 580ea4e..1e3e5d8 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -261,11 +261,6 @@ public abstract class BSLinkset
261 // Called at taint-time!! 261 // Called at taint-time!!
262 public abstract bool RemoveBodyDependencies(BSPrim child); 262 public abstract bool RemoveBodyDependencies(BSPrim child);
263 263
264 // Companion to RemoveBodyDependencies(). If RemoveBodyDependencies() returns 'true',
265 // this routine will restore the removed constraints.
266 // Called at taint-time!!
267 public abstract void RestoreBodyDependencies(BSPrim child);
268
269 // ================================================================ 264 // ================================================================
270 protected virtual float ComputeLinksetMass() 265 protected virtual float ComputeLinksetMass()
271 { 266 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 27d8ad0..2c8dd23 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -290,13 +290,6 @@ public sealed class BSLinksetCompound : BSLinkset
290 return ret; 290 return ret;
291 } 291 }
292 292
293 // Companion to RemoveBodyDependencies(). If RemoveBodyDependencies() returns 'true',
294 // this routine will restore the removed constraints.
295 // Called at taint-time!!
296 public override void RestoreBodyDependencies(BSPrim child)
297 {
298 }
299
300 // When the linkset is built, the child shape is added to the compound shape relative to the 293 // When the linkset is built, the child shape is added to the compound shape relative to the
301 // root shape. The linkset then moves around but this does not move the actual child 294 // root shape. The linkset then moves around but this does not move the actual child
302 // prim. The child prim's location must be recomputed based on the location of the root shape. 295 // prim. The child prim's location must be recomputed based on the location of the root shape.
@@ -384,7 +377,7 @@ public sealed class BSLinksetCompound : BSLinkset
384 // Constraint linksets are rebuilt every time. 377 // Constraint linksets are rebuilt every time.
385 // 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.
386 // Called at taint time!! 379 // Called at taint time!!
387 private bool disableCOM = true; // disable until we get this debugged 380 private bool disableCOM = false; // disable until we get this debugged
388 private void RecomputeLinksetCompound() 381 private void RecomputeLinksetCompound()
389 { 382 {
390 try 383 try
@@ -407,12 +400,16 @@ public sealed class BSLinksetCompound : BSLinkset
407 } // DEBUG DEBUG 400 } // DEBUG DEBUG
408 else 401 else
409 { 402 {
410 centerOfMass = ComputeLinksetGeometricCenter(); 403 centerOfMass = ComputeLinksetCenterOfMass();
411 centerDisplacement = centerOfMass - LinksetRoot.RawPosition; 404 // 'centerDisplacement' is the value to *add* to all the shape offsets
405 centerDisplacement = LinksetRoot.RawPosition - centerOfMass;
412 406
413 // 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
414 LinksetRoot.PositionDisplacement = centerDisplacement; 408 LinksetRoot.PositionDisplacement = centerDisplacement;
415 409
410 // This causes the root prim position to be set properly based on the new PositionDisplacement
411 LinksetRoot.ForcePosition = LinksetRoot.RawPosition;
412 // Update the local transform for the root child shape so it is offset from the <0,0,0> which is COM
416 PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, 0, -centerDisplacement, OMV.Quaternion.Identity, false); 413 PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, 0, -centerDisplacement, OMV.Quaternion.Identity, false);
417 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,com={1},rootPos={2},centerDisp={3}", 414 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,com={1},rootPos={2},centerDisp={3}",
418 LinksetRoot.LocalID, centerOfMass, LinksetRoot.RawPosition, centerDisplacement); 415 LinksetRoot.LocalID, centerOfMass, LinksetRoot.RawPosition, centerDisplacement);
@@ -444,7 +441,7 @@ public sealed class BSLinksetCompound : BSLinkset
444 441
445 if (cPrim.PhysShape.isNativeShape) 442 if (cPrim.PhysShape.isNativeShape)
446 { 443 {
447 // A native shape is turning into a hull collision shape because native 444 // A native shape is turned into a hull collision shape because native
448 // shapes are not shared so we have to hullify it so it will be tracked 445 // shapes are not shared so we have to hullify it so it will be tracked
449 // and freed at the correct time. This also solves the scaling problem 446 // and freed at the correct time. This also solves the scaling problem
450 // (native shapes scaled but hull/meshes are assumed to not be). 447 // (native shapes scaled but hull/meshes are assumed to not be).
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
index 89f186c..3011465 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
@@ -110,14 +110,6 @@ public sealed class BSLinksetConstraints : BSLinkset
110 return ret; 110 return ret;
111 } 111 }
112 112
113 // Companion to RemoveBodyDependencies(). If RemoveBodyDependencies() returns 'true',
114 // this routine will restore the removed constraints.
115 // Called at taint-time!!
116 public override void RestoreBodyDependencies(BSPrim child)
117 {
118 // The Refresh operation queued by RemoveBodyDependencies() will build any missing constraints.
119 }
120
121 // ================================================================ 113 // ================================================================
122 114
123 // Add a new child to the linkset. 115 // Add a new child to the linkset.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index da7438a..9460daf 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -645,11 +645,8 @@ public static class BSParam
645 entries.Add(new PhysParameterEntry(pd.name, pd.desc)); 645 entries.Add(new PhysParameterEntry(pd.name, pd.desc));
646 } 646 }
647 647
648 // make the list in alphabetical order for estetic reasons 648 // make the list alphabetical for estetic reasons
649 entries.Sort(delegate(PhysParameterEntry ppe1, PhysParameterEntry ppe2) 649 entries.Sort((ppe1, ppe2) => { return ppe1.name.CompareTo(ppe2.name); });
650 {
651 return ppe1.name.CompareTo(ppe2.name);
652 });
653 650
654 SettableParameters = entries.ToArray(); 651 SettableParameters = entries.ToArray();
655 } 652 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index e6b8507..f80084a 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -322,6 +322,7 @@ public sealed class BSPrim : BSPhysObject
322 }); 322 });
323 } 323 }
324 } 324 }
325
325 public override OMV.Vector3 ForcePosition { 326 public override OMV.Vector3 ForcePosition {
326 get { 327 get {
327 _position = PhysicsScene.PE.GetPosition(PhysBody) - PositionDisplacement; 328 _position = PhysicsScene.PE.GetPosition(PhysBody) - PositionDisplacement;
@@ -336,25 +337,6 @@ public sealed class BSPrim : BSPhysObject
336 } 337 }
337 } 338 }
338 } 339 }
339 // Override to have position displacement immediately update the physical position.
340 // A feeble attempt to keep the sim and physical positions in sync
341 // Must be called at taint time.
342 public override OMV.Vector3 PositionDisplacement
343 {
344 get
345 {
346 return base.PositionDisplacement;
347 }
348 set
349 {
350 base.PositionDisplacement = value;
351 PhysicsScene.TaintedObject(PhysicsScene.InTaintTime, "BSPrim.setPosition", delegate()
352 {
353 if (PhysBody.HasPhysicalBody)
354 PhysicsScene.PE.SetTranslation(PhysBody, _position + base.PositionDisplacement, _orientation);
355 });
356 }
357 }
358 340
359 // Check that the current position is sane and, if not, modify the position to make it so. 341 // 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. 342 // Check for being below terrain and being out of bounds.
@@ -371,11 +353,11 @@ public sealed class BSPrim : BSPhysObject
371 return ret; 353 return ret;
372 } 354 }
373 355
374 float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(_position); 356 float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(RawPosition);
375 OMV.Vector3 upForce = OMV.Vector3.Zero; 357 OMV.Vector3 upForce = OMV.Vector3.Zero;
376 if (RawPosition.Z < terrainHeight) 358 if (RawPosition.Z < terrainHeight)
377 { 359 {
378 DetailLog("{0},BSPrim.PositionAdjustUnderGround,call,pos={1},terrain={2}", LocalID, _position, terrainHeight); 360 DetailLog("{0},BSPrim.PositionAdjustUnderGround,call,pos={1},terrain={2}", LocalID, RawPosition, terrainHeight);
379 float targetHeight = terrainHeight + (Size.Z / 2f); 361 float targetHeight = terrainHeight + (Size.Z / 2f);
380 // If the object is below ground it just has to be moved up because pushing will 362 // If the object is below ground it just has to be moved up because pushing will
381 // not get it through the terrain 363 // not get it through the terrain
@@ -1606,11 +1588,6 @@ public sealed class BSPrim : BSPhysObject
1606 // Called at taint-time!!! 1588 // Called at taint-time!!!
1607 public void CreateGeomAndObject(bool forceRebuild) 1589 public void CreateGeomAndObject(bool forceRebuild)
1608 { 1590 {
1609 // If this prim is part of a linkset, we must remove and restore the physical
1610 // links if the body is rebuilt.
1611 bool needToRestoreLinkset = false;
1612 bool needToRestoreVehicle = false;
1613
1614 // Create the correct physical representation for this type of object. 1591 // Create the correct physical representation for this type of object.
1615 // Updates PhysBody and PhysShape with the new information. 1592 // Updates PhysBody and PhysShape with the new information.
1616 // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary. 1593 // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary.
@@ -1619,21 +1596,10 @@ public sealed class BSPrim : BSPhysObject
1619 // Called if the current prim body is about to be destroyed. 1596 // Called if the current prim body is about to be destroyed.
1620 // Remove all the physical dependencies on the old body. 1597 // Remove all the physical dependencies on the old body.
1621 // (Maybe someday make the changing of BSShape an event to be subscribed to by BSLinkset, ...) 1598 // (Maybe someday make the changing of BSShape an event to be subscribed to by BSLinkset, ...)
1622 needToRestoreLinkset = Linkset.RemoveBodyDependencies(this); 1599 Linkset.RemoveBodyDependencies(this);
1623 needToRestoreVehicle = _vehicle.RemoveBodyDependencies(this); 1600 _vehicle.RemoveBodyDependencies(this);
1624 }); 1601 });
1625 1602
1626 if (needToRestoreLinkset)
1627 {
1628 // If physical body dependencies were removed, restore them
1629 Linkset.RestoreBodyDependencies(this);
1630 }
1631 if (needToRestoreVehicle)
1632 {
1633 // If physical body dependencies were removed, restore them
1634 _vehicle.RestoreBodyDependencies(this);
1635 }
1636
1637 // Make sure the properties are set on the new object 1603 // Make sure the properties are set on the new object
1638 UpdatePhysicalParameters(); 1604 UpdatePhysicalParameters();
1639 return; 1605 return;
@@ -1653,14 +1619,25 @@ public sealed class BSPrim : BSPhysObject
1653 // entprop.RotationalVelocity = OMV.Vector3.Zero; 1619 // entprop.RotationalVelocity = OMV.Vector3.Zero;
1654 } 1620 }
1655 1621
1622 // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG
1623
1624 // Undo any center-of-mass displacement that might have been done.
1625 if (PositionDisplacement != OMV.Vector3.Zero)
1626 {
1627 // Correct for any rotation around the center-of-mass
1628 // TODO!!!
1629 entprop.Position -= PositionDisplacement;
1630 }
1631
1656 // Assign directly to the local variables so the normal set actions do not happen 1632 // Assign directly to the local variables so the normal set actions do not happen
1657 entprop.Position -= PositionDisplacement;
1658 _position = entprop.Position; 1633 _position = entprop.Position;
1659 _orientation = entprop.Rotation; 1634 _orientation = entprop.Rotation;
1660 _velocity = entprop.Velocity; 1635 _velocity = entprop.Velocity;
1661 _acceleration = entprop.Acceleration; 1636 _acceleration = entprop.Acceleration;
1662 _rotationalVelocity = entprop.RotationalVelocity; 1637 _rotationalVelocity = entprop.RotationalVelocity;
1663 1638
1639 // DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG
1640
1664 // The sanity check can change the velocity and/or position. 1641 // The sanity check can change the velocity and/or position.
1665 if (IsPhysical && PositionSanityCheck(true)) 1642 if (IsPhysical && PositionSanityCheck(true))
1666 { 1643 {
@@ -1669,8 +1646,7 @@ public sealed class BSPrim : BSPhysObject
1669 } 1646 }
1670 1647
1671 OMV.Vector3 direction = OMV.Vector3.UnitX * _orientation; // DEBUG DEBUG DEBUG 1648 OMV.Vector3 direction = OMV.Vector3.UnitX * _orientation; // DEBUG DEBUG DEBUG
1672 DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},dir={3},vel={4},rotVel={5}", 1649 DetailLog("{0},BSPrim.UpdateProperties,call,entProp={1},dir={2}", LocalID, entprop, direction);
1673 LocalID, _position, _orientation, direction, _velocity, _rotationalVelocity);
1674 1650
1675 // remember the current and last set values 1651 // remember the current and last set values
1676 LastEntityProperties = CurrentEntityProperties; 1652 LastEntityProperties = CurrentEntityProperties;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 8075b73..34fd2a0 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -708,8 +708,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
708 // TriggerPreStepEvent 708 // TriggerPreStepEvent
709 // DoOneTimeTaints 709 // DoOneTimeTaints
710 // Step() 710 // Step()
711 // ProcessAndForwardCollisions 711 // ProcessAndSendToSimulatorCollisions
712 // ProcessAndForwardPropertyUpdates 712 // ProcessAndSendToSimulatorPropertyUpdates
713 // TriggerPostStepEvent 713 // TriggerPostStepEvent
714 714
715 // Calls to the PhysicsActors can't directly call into the physics engine 715 // Calls to the PhysicsActors can't directly call into the physics engine
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