aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
diff options
context:
space:
mode:
authorRobert Adams2012-10-10 08:02:37 -0700
committerRobert Adams2012-10-11 14:01:10 -0700
commita791620622dc0a67a6af2c4a9c011d9057360411 (patch)
tree4a08389e4e166fff4149b3e5f46bba8f64557846 /OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
parentBulletSim: Add Force* operations to objects to allow direct push to engine. (diff)
downloadopensim-SC_OLD-a791620622dc0a67a6af2c4a9c011d9057360411.zip
opensim-SC_OLD-a791620622dc0a67a6af2c4a9c011d9057360411.tar.gz
opensim-SC_OLD-a791620622dc0a67a6af2c4a9c011d9057360411.tar.bz2
opensim-SC_OLD-a791620622dc0a67a6af2c4a9c011d9057360411.tar.xz
BulletSim: cosmetic changes (comments and renaming). Give mass to terrain to improve interactions.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs14
1 files changed, 8 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
index 70aa429..2808603 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
@@ -201,10 +201,10 @@ public class BSTerrainManager
201 // The 'doNow' boolean says whether to do all the unmanaged activities right now (like when 201 // The 'doNow' boolean says whether to do all the unmanaged activities right now (like when
202 // calling this routine from initialization or taint-time routines) or whether to delay 202 // calling this routine from initialization or taint-time routines) or whether to delay
203 // all the unmanaged activities to taint-time. 203 // all the unmanaged activities to taint-time.
204 private void UpdateOrCreateTerrain(uint id, float[] heightMap, Vector3 minCoords, Vector3 maxCoords, bool atTaintTime) 204 private void UpdateOrCreateTerrain(uint id, float[] heightMap, Vector3 minCoords, Vector3 maxCoords, bool inTaintTime)
205 { 205 {
206 DetailLog("{0},BSTerrainManager.UpdateOrCreateTerrain,call,minC={1},maxC={2},atTaintTime={3}", 206 DetailLog("{0},BSTerrainManager.UpdateOrCreateTerrain,call,minC={1},maxC={2},inTaintTime={3}",
207 BSScene.DetailLogZero, minCoords, maxCoords, atTaintTime); 207 BSScene.DetailLogZero, minCoords, maxCoords, inTaintTime);
208 208
209 float minZ = float.MaxValue; 209 float minZ = float.MaxValue;
210 float maxZ = float.MinValue; 210 float maxZ = float.MinValue;
@@ -320,7 +320,9 @@ public class BSTerrainManager
320 BulletSimAPI.SetRestitution2(mapInfo.terrainBody.ptr, PhysicsScene.Params.terrainRestitution); 320 BulletSimAPI.SetRestitution2(mapInfo.terrainBody.ptr, PhysicsScene.Params.terrainRestitution);
321 BulletSimAPI.SetCollisionFlags2(mapInfo.terrainBody.ptr, CollisionFlags.CF_STATIC_OBJECT); 321 BulletSimAPI.SetCollisionFlags2(mapInfo.terrainBody.ptr, CollisionFlags.CF_STATIC_OBJECT);
322 322
323 BulletSimAPI.SetMassProps2(mapInfo.terrainBody.ptr, 0f, Vector3.Zero); 323 float terrainMass = 1000;
324 Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(mapInfo.terrainBody.ptr, terrainMass);
325 BulletSimAPI.SetMassProps2(mapInfo.terrainBody.ptr, terrainMass, localInertia);
324 BulletSimAPI.UpdateInertiaTensor2(mapInfo.terrainBody.ptr); 326 BulletSimAPI.UpdateInertiaTensor2(mapInfo.terrainBody.ptr);
325 327
326 // Return the new terrain to the world of physical objects 328 // Return the new terrain to the world of physical objects
@@ -342,7 +344,7 @@ public class BSTerrainManager
342 344
343 // There is the option to do the changes now (we're already in 'taint time'), or 345 // There is the option to do the changes now (we're already in 'taint time'), or
344 // to do the Bullet operations later. 346 // to do the Bullet operations later.
345 if (atTaintTime) 347 if (inTaintTime)
346 rebuildOperation(); 348 rebuildOperation();
347 else 349 else
348 PhysicsScene.TaintedObject("BSScene.UpdateOrCreateTerrain:UpdateExisting", rebuildOperation); 350 PhysicsScene.TaintedObject("BSScene.UpdateOrCreateTerrain:UpdateExisting", rebuildOperation);
@@ -381,7 +383,7 @@ public class BSTerrainManager
381 }; 383 };
382 384
383 // If already in taint-time, just call Bullet. Otherwise queue the operations for the safe time. 385 // If already in taint-time, just call Bullet. Otherwise queue the operations for the safe time.
384 if (atTaintTime) 386 if (inTaintTime)
385 createOperation(); 387 createOperation();
386 else 388 else
387 PhysicsScene.TaintedObject("BSScene.UpdateOrCreateTerrain:NewTerrain", createOperation); 389 PhysicsScene.TaintedObject("BSScene.UpdateOrCreateTerrain:NewTerrain", createOperation);