aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
diff options
context:
space:
mode:
authorRobert Adams2012-09-26 09:25:56 -0700
committerRobert Adams2012-09-27 22:01:47 -0700
commit4589bc84a32366c6aae68b67f1fc7a2ee08be86d (patch)
treee635ab006f40e85eeb7b49870c04e6b2ca572dee /OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
parentBulletSim: btGhostObjects working to make 'volume detect' work. (diff)
downloadopensim-SC-4589bc84a32366c6aae68b67f1fc7a2ee08be86d.zip
opensim-SC-4589bc84a32366c6aae68b67f1fc7a2ee08be86d.tar.gz
opensim-SC-4589bc84a32366c6aae68b67f1fc7a2ee08be86d.tar.bz2
opensim-SC-4589bc84a32366c6aae68b67f1fc7a2ee08be86d.tar.xz
BulletSim: Terrain sets proper collision flags on creation.
Static objects are set to ISLAND_SLEEPING rather than DISABLE_SIMULATION. Might reconsider this and, alternatively, have dynamic objects force activation. Clean up use of DetailLog().
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs20
1 files changed, 10 insertions, 10 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
index 5d5d9cb..50638d6 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 doNow) 204 private void UpdateOrCreateTerrain(uint id, float[] heightMap, Vector3 minCoords, Vector3 maxCoords, bool atTaintTime)
205 { 205 {
206 DetailLog("{0},BSTerrainManager.UpdateOrCreateTerrain,call,minC={1},maxC={2},doNow={3}", 206 DetailLog("{0},BSTerrainManager.UpdateOrCreateTerrain,call,minC={1},maxC={2},atTaintTime={3}",
207 BSScene.DetailLogZero, minCoords, maxCoords, doNow); 207 BSScene.DetailLogZero, minCoords, maxCoords, atTaintTime);
208 208
209 float minZ = float.MaxValue; 209 float minZ = float.MaxValue;
210 float maxZ = float.MinValue; 210 float maxZ = float.MinValue;
@@ -308,11 +308,7 @@ public class BSTerrainManager
308 308
309 mapInfo.terrainBody = new BulletBody(mapInfo.ID, 309 mapInfo.terrainBody = new BulletBody(mapInfo.ID,
310 BulletSimAPI.CreateBodyWithDefaultMotionState2(mapInfo.terrainShape.ptr, 310 BulletSimAPI.CreateBodyWithDefaultMotionState2(mapInfo.terrainShape.ptr,
311 id, centerPos, Quaternion.Identity)); 311 id, centerPos, Quaternion.Identity));
312
313 BulletSimAPI.SetCollisionFilterMask2(mapInfo.terrainBody.ptr,
314 (uint)CollisionFilterGroups.TerrainFilter,
315 (uint)CollisionFilterGroups.TerrainMask);
316 } 312 }
317 313
318 // Make sure the entry is in the heightmap table 314 // Make sure the entry is in the heightmap table
@@ -333,6 +329,10 @@ public class BSTerrainManager
333 // redo its bounding box now that it is in the world 329 // redo its bounding box now that it is in the world
334 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, mapInfo.terrainBody.ptr); 330 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, mapInfo.terrainBody.ptr);
335 331
332 BulletSimAPI.SetCollisionFilterMask2(mapInfo.terrainBody.ptr,
333 (uint)CollisionFilterGroups.TerrainFilter,
334 (uint)CollisionFilterGroups.TerrainMask);
335
336 // Make sure the new shape is processed. 336 // Make sure the new shape is processed.
337 BulletSimAPI.Activate2(mapInfo.terrainBody.ptr, true); 337 BulletSimAPI.Activate2(mapInfo.terrainBody.ptr, true);
338 338
@@ -341,7 +341,7 @@ public class BSTerrainManager
341 341
342 // There is the option to do the changes now (we're already in 'taint time'), or 342 // There is the option to do the changes now (we're already in 'taint time'), or
343 // to do the Bullet operations later. 343 // to do the Bullet operations later.
344 if (doNow) 344 if (atTaintTime)
345 rebuildOperation(); 345 rebuildOperation();
346 else 346 else
347 PhysicsScene.TaintedObject("BSScene.UpdateOrCreateTerrain:UpdateExisting", rebuildOperation); 347 PhysicsScene.TaintedObject("BSScene.UpdateOrCreateTerrain:UpdateExisting", rebuildOperation);
@@ -380,7 +380,7 @@ public class BSTerrainManager
380 }; 380 };
381 381
382 // If already in taint-time, just call Bullet. Otherwise queue the operations for the safe time. 382 // If already in taint-time, just call Bullet. Otherwise queue the operations for the safe time.
383 if (doNow) 383 if (atTaintTime)
384 createOperation(); 384 createOperation();
385 else 385 else
386 PhysicsScene.TaintedObject("BSScene.UpdateOrCreateTerrain:NewTerrain", createOperation); 386 PhysicsScene.TaintedObject("BSScene.UpdateOrCreateTerrain:NewTerrain", createOperation);