aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
authorRobert Adams2013-01-13 22:32:31 -0800
committerRobert Adams2013-01-14 07:50:58 -0800
commit8bf0a9f85dda4b1831630b65620d5c6868196c11 (patch)
treed79799e42210133f4893d4661f0dd22124027f70 /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
parentBulletSim: move center of gravity of linkset to its geometric center. (diff)
downloadopensim-SC_OLD-8bf0a9f85dda4b1831630b65620d5c6868196c11.zip
opensim-SC_OLD-8bf0a9f85dda4b1831630b65620d5c6868196c11.tar.gz
opensim-SC_OLD-8bf0a9f85dda4b1831630b65620d5c6868196c11.tar.bz2
opensim-SC_OLD-8bf0a9f85dda4b1831630b65620d5c6868196c11.tar.xz
BulletSim: disable center-of-mass computation for linksets until debugged. Move physical prim above ground if it is underground. Previously tried to correct by applying and up force but the prim would never go through the ground.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs26
1 files changed, 12 insertions, 14 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 003dc54..e5f7ab7 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -297,7 +297,7 @@ public sealed class BSPrim : BSPhysObject
297 */ 297 */
298 298
299 // don't do the GetObjectPosition for root elements because this function is called a zillion times. 299 // don't do the GetObjectPosition for root elements because this function is called a zillion times.
300 // _position = PhysicsScene.PE.GetObjectPosition2(PhysicsScene.World, BSBody); 300 // _position = PhysicsScene.PE.GetObjectPosition2(PhysicsScene.World, BSBody) - PositionDisplacement;
301 return _position; 301 return _position;
302 } 302 }
303 set { 303 set {
@@ -362,7 +362,7 @@ public sealed class BSPrim : BSPhysObject
362 { 362 {
363 bool ret = false; 363 bool ret = false;
364 364
365 if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(_position)) 365 if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(RawPosition))
366 { 366 {
367 // The physical object is out of the known/simulated area. 367 // The physical object is out of the known/simulated area.
368 // Upper levels of code will handle the transition to other areas so, for 368 // Upper levels of code will handle the transition to other areas so, for
@@ -376,8 +376,11 @@ public sealed class BSPrim : BSPhysObject
376 { 376 {
377 DetailLog("{0},BSPrim.PositionAdjustUnderGround,call,pos={1},terrain={2}", LocalID, _position, terrainHeight); 377 DetailLog("{0},BSPrim.PositionAdjustUnderGround,call,pos={1},terrain={2}", LocalID, _position, terrainHeight);
378 float targetHeight = terrainHeight + (Size.Z / 2f); 378 float targetHeight = terrainHeight + (Size.Z / 2f);
379 // Upforce proportional to the distance away from the terrain. Correct the error in 1 sec. 379 // If the object is below ground it just has to be moved up because pushing will
380 upForce.Z = (terrainHeight - RawPosition.Z) * 1f; 380 // not get it through the terrain
381 _position.Z = targetHeight;
382 if (!inTaintTime)
383 ForcePosition = _position;
381 ret = true; 384 ret = true;
382 } 385 }
383 386
@@ -389,20 +392,15 @@ public sealed class BSPrim : BSPhysObject
389 { 392 {
390 // Upforce proportional to the distance away from the water. Correct the error in 1 sec. 393 // Upforce proportional to the distance away from the water. Correct the error in 1 sec.
391 upForce.Z = (waterHeight - RawPosition.Z) * 1f; 394 upForce.Z = (waterHeight - RawPosition.Z) * 1f;
395
396 // Apply upforce and overcome gravity.
397 OMV.Vector3 correctionForce = upForce - PhysicsScene.DefaultGravity;
398 DetailLog("{0},BSPrim.PositionSanityCheck,applyForce,pos={1},upForce={2},correctionForce={3}", LocalID, _position, upForce, correctionForce);
399 AddForce(correctionForce, false, inTaintTime);
392 ret = true; 400 ret = true;
393 } 401 }
394 } 402 }
395 403
396 // The above code computes a force to apply to correct any out-of-bounds problems. Apply same.
397 // TODO: This should be intergrated with a geneal physics action mechanism.
398 // TODO: This should be moderated with PID'ness.
399 if (ret)
400 {
401 // Apply upforce and overcome gravity.
402 OMV.Vector3 correctionForce = upForce - PhysicsScene.DefaultGravity;
403 DetailLog("{0},BSPrim.PositionSanityCheck,applyForce,pos={1},upForce={2},correctionForce={3}", LocalID, _position, upForce, correctionForce);
404 AddForce(correctionForce, false, inTaintTime);
405 }
406 return ret; 404 return ret;
407 } 405 }
408 406