aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorRobert Adams2012-08-17 14:45:18 -0700
committerRobert Adams2012-08-17 14:45:18 -0700
commit7243d4f84248092eb5fe4ebe3673501bc84ce250 (patch)
tree0d6ace8f444a2f96dfe97dbc924316573f0d5274 /OpenSim/Region/Physics
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-7243d4f84248092eb5fe4ebe3673501bc84ce250.zip
opensim-SC_OLD-7243d4f84248092eb5fe4ebe3673501bc84ce250.tar.gz
opensim-SC_OLD-7243d4f84248092eb5fe4ebe3673501bc84ce250.tar.bz2
opensim-SC_OLD-7243d4f84248092eb5fe4ebe3673501bc84ce250.tar.xz
BulletSim: Properly regenerate hulls when objects made physical.
This fixes the problem of non-base shapes (cubes and spheres) falling through the terrain.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs34
1 files changed, 25 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index a6bc8e2..d3f1e9c 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -481,11 +481,8 @@ public sealed class BSPrim : PhysicsActor
481 // No locking here because only called when it is safe 481 // No locking here because only called when it is safe
482 private void SetObjectDynamic() 482 private void SetObjectDynamic()
483 { 483 {
484 // RA: remove this for the moment. 484 // If it's becoming dynamic, it will need hullness
485 // The problem is that dynamic objects are hulls so if we are becoming physical 485 VerifyCorrectPhysicalShape();
486 // the shape has to be checked and possibly built.
487 // Maybe a VerifyCorrectPhysicalShape() routine?
488 // RecreateGeomAndObject();
489 486
490 // Bullet wants static objects to have a mass of zero 487 // Bullet wants static objects to have a mass of zero
491 float mass = IsStatic ? 0f : _mass; 488 float mass = IsStatic ? 0f : _mass;
@@ -1214,6 +1211,27 @@ public sealed class BSPrim : PhysicsActor
1214 return; 1211 return;
1215 } 1212 }
1216 1213
1214 private void VerifyCorrectPhysicalShape()
1215 {
1216 if (IsStatic)
1217 {
1218 // if static, we don't need a hull so, if there is one, rebuild without it
1219 if (_hullKey != 0)
1220 {
1221 RecreateGeomAndObject();
1222 }
1223 }
1224 else
1225 {
1226 // if not static, it will need a hull to efficiently collide with things
1227 if (_hullKey == 0)
1228 {
1229 RecreateGeomAndObject();
1230 }
1231
1232 }
1233 }
1234
1217 // Create an object in Bullet if it has not already been created 1235 // Create an object in Bullet if it has not already been created
1218 // No locking here because this is done when the physics engine is not simulating 1236 // No locking here because this is done when the physics engine is not simulating
1219 // Returns 'true' if an object was actually created. 1237 // Returns 'true' if an object was actually created.
@@ -1338,10 +1356,8 @@ public sealed class BSPrim : PhysicsActor
1338 _acceleration = entprop.Acceleration; 1356 _acceleration = entprop.Acceleration;
1339 _rotationalVelocity = entprop.RotationalVelocity; 1357 _rotationalVelocity = entprop.RotationalVelocity;
1340 1358
1341 // m_log.DebugFormat("{0}: RequestTerseUpdate. id={1}, ch={2}, pos={3}, rot={4}, vel={5}, acc={6}, rvel={7}", 1359 DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}",
1342 // LogHeader, LocalID, changed, _position, _orientation, _velocity, _acceleration, _rotationalVelocity); 1360 LocalID, _position, _orientation, _velocity, _acceleration, _rotationalVelocity);
1343 // DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}",
1344 // LocalID, _position, _orientation, _velocity, _acceleration, _rotationalVelocity);
1345 1361
1346 base.RequestPhysicsterseUpdate(); 1362 base.RequestPhysicsterseUpdate();
1347 } 1363 }