aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs19
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs2
4 files changed, 23 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 77bdacb..cb0d929 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -39,6 +39,20 @@ public static class BSParam
39{ 39{
40 private static string LogHeader = "[BULLETSIM PARAMETERS]"; 40 private static string LogHeader = "[BULLETSIM PARAMETERS]";
41 41
42 // Tuning notes:
43 // From: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=6575
44 // Contact points can be added even if the distance is positive. The constraint solver can deal with
45 // contacts with positive distances as well as negative (penetration). Contact points are discarded
46 // if the distance exceeds a certain threshold.
47 // Bullet has a contact processing threshold and a contact breaking threshold.
48 // If the distance is larger than the contact breaking threshold, it will be removed after one frame.
49 // If the distance is larger than the contact processing threshold, the constraint solver will ignore it.
50
51 // This is separate/independent from the collision margin. The collision margin increases the object a bit
52 // to improve collision detection performance and accuracy.
53 // ===================
54 // From:
55
42 // Level of Detail values kept as float because that's what the Meshmerizer wants 56 // Level of Detail values kept as float because that's what the Meshmerizer wants
43 public static float MeshLOD { get; private set; } 57 public static float MeshLOD { get; private set; }
44 public static float MeshCircularLOD { get; private set; } 58 public static float MeshCircularLOD { get; private set; }
@@ -77,6 +91,7 @@ public static class BSParam
77 public static float TerrainFriction { get; private set; } 91 public static float TerrainFriction { get; private set; }
78 public static float TerrainHitFraction { get; private set; } 92 public static float TerrainHitFraction { get; private set; }
79 public static float TerrainRestitution { get; private set; } 93 public static float TerrainRestitution { get; private set; }
94 public static float TerrainContactProcessingThreshold { get; private set; }
80 public static float TerrainCollisionMargin { get; private set; } 95 public static float TerrainCollisionMargin { get; private set; }
81 96
82 public static float DefaultFriction { get; private set; } 97 public static float DefaultFriction { get; private set; }
@@ -458,6 +473,10 @@ public static class BSParam
458 0f, 473 0f,
459 (s) => { return TerrainRestitution; }, 474 (s) => { return TerrainRestitution; },
460 (s,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), 475 (s,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ),
476 new ParameterDefn<float>("TerrainContactProcessingThreshold", "Distance from terrain to stop processing collisions" ,
477 0.0f,
478 (s) => { return TerrainContactProcessingThreshold; },
479 (s,v) => { TerrainContactProcessingThreshold = v; /* TODO: set on real terrain */ } ),
461 new ParameterDefn<float>("TerrainCollisionMargin", "Margin where collision checking starts" , 480 new ParameterDefn<float>("TerrainCollisionMargin", "Margin where collision checking starts" ,
462 0.08f, 481 0.08f,
463 (s) => { return TerrainCollisionMargin; }, 482 (s) => { return TerrainCollisionMargin; },
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index a465613..2cbbe9a 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -947,9 +947,9 @@ public class BSPrim : BSPhysObject
947 ZeroMotion(true); 947 ZeroMotion(true);
948 948
949 // Set various physical properties so other object interact properly 949 // Set various physical properties so other object interact properly
950 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false);
951 PhysicsScene.PE.SetFriction(PhysBody, Friction); 950 PhysicsScene.PE.SetFriction(PhysBody, Friction);
952 PhysicsScene.PE.SetRestitution(PhysBody, Restitution); 951 PhysicsScene.PE.SetRestitution(PhysBody, Restitution);
952 PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold);
953 953
954 // Mass is zero which disables a bunch of physics stuff in Bullet 954 // Mass is zero which disables a bunch of physics stuff in Bullet
955 UpdatePhysicalMassProperties(0f, false); 955 UpdatePhysicalMassProperties(0f, false);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
index e8040d8..a60946d 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
@@ -263,6 +263,7 @@ public sealed class BSTerrainManager : IDisposable
263 263
264 if (MegaRegionParentPhysicsScene == null) 264 if (MegaRegionParentPhysicsScene == null)
265 { 265 {
266 // This terrain is not part of the mega-region scheme. Create vanilla terrain.
266 BSTerrainPhys newTerrainPhys = BuildPhysicalTerrain(terrainRegionBase, id, heightMap, minCoords, maxCoords); 267 BSTerrainPhys newTerrainPhys = BuildPhysicalTerrain(terrainRegionBase, id, heightMap, minCoords, maxCoords);
267 m_terrains.Add(terrainRegionBase, newTerrainPhys); 268 m_terrains.Add(terrainRegionBase, newTerrainPhys);
268 269
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
index 57a5ff2..c9a75ae 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
@@ -112,11 +112,13 @@ public sealed class BSTerrainMesh : BSTerrainPhys
112 // Something is very messed up and a crash is in our future. 112 // Something is very messed up and a crash is in our future.
113 return; 113 return;
114 } 114 }
115 physicsScene.PE.SetShapeCollisionMargin(m_terrainShape, BSParam.TerrainCollisionMargin);
115 116
116 // Set current terrain attributes 117 // Set current terrain attributes
117 PhysicsScene.PE.SetFriction(m_terrainBody, BSParam.TerrainFriction); 118 PhysicsScene.PE.SetFriction(m_terrainBody, BSParam.TerrainFriction);
118 PhysicsScene.PE.SetHitFraction(m_terrainBody, BSParam.TerrainHitFraction); 119 PhysicsScene.PE.SetHitFraction(m_terrainBody, BSParam.TerrainHitFraction);
119 PhysicsScene.PE.SetRestitution(m_terrainBody, BSParam.TerrainRestitution); 120 PhysicsScene.PE.SetRestitution(m_terrainBody, BSParam.TerrainRestitution);
121 PhysicsScene.PE.SetContactProcessingThreshold(m_terrainBody, BSParam.TerrainContactProcessingThreshold);
120 PhysicsScene.PE.SetCollisionFlags(m_terrainBody, CollisionFlags.CF_STATIC_OBJECT); 122 PhysicsScene.PE.SetCollisionFlags(m_terrainBody, CollisionFlags.CF_STATIC_OBJECT);
121 123
122 // Static objects are not very massive. 124 // Static objects are not very massive.