aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRobert Adams2012-08-17 14:45:18 -0700
committerRobert Adams2012-08-17 14:45:18 -0700
commit7243d4f84248092eb5fe4ebe3673501bc84ce250 (patch)
tree0d6ace8f444a2f96dfe97dbc924316573f0d5274
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-7243d4f84248092eb5fe4ebe3673501bc84ce250.zip
opensim-SC-7243d4f84248092eb5fe4ebe3673501bc84ce250.tar.gz
opensim-SC-7243d4f84248092eb5fe4ebe3673501bc84ce250.tar.bz2
opensim-SC-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 '')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs16
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs34
2 files changed, 33 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 98afb75..65d526f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1392,14 +1392,14 @@ namespace OpenSim.Region.Framework.Scenes
1392 else if (FlyDisabled) 1392 else if (FlyDisabled)
1393 newFlying = false; 1393 newFlying = false;
1394 else 1394 else
1395 newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1395 newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1396 1396
1397 if (actor.Flying != newFlying) 1397 if (actor.Flying != newFlying)
1398 { 1398 {
1399 // Note: ScenePresence.Flying is actually fetched from the physical actor 1399 // Note: ScenePresence.Flying is actually fetched from the physical actor
1400 // so setting PhysActor.Flying here also sets the ScenePresence's value. 1400 // so setting PhysActor.Flying here also sets the ScenePresence's value.
1401 actor.Flying = newFlying; 1401 actor.Flying = newFlying;
1402 update_movementflag = true; 1402 update_movementflag = true;
1403 } 1403 }
1404 1404
1405 if (ParentID == 0) 1405 if (ParentID == 0)
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 }