aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
diff options
context:
space:
mode:
authorRobert Adams2012-03-16 16:37:21 -0700
committerRobert Adams2012-03-21 16:16:44 -0700
commit898a16802bceab9cc43ad15be6f4354335b471fb (patch)
tree30bab8f5dc50fe7769287a0db33c09d5e6d940a1 /OpenSim/Region/Physics/BulletSPlugin
parentBulletSim: update BulletSim.dll to Bullet 2.80 and add libBulletSim.so to the... (diff)
downloadopensim-SC_OLD-898a16802bceab9cc43ad15be6f4354335b471fb.zip
opensim-SC_OLD-898a16802bceab9cc43ad15be6f4354335b471fb.tar.gz
opensim-SC_OLD-898a16802bceab9cc43ad15be6f4354335b471fb.tar.bz2
opensim-SC_OLD-898a16802bceab9cc43ad15be6f4354335b471fb.tar.xz
BulletSim: add some new runtime setable parameters to match the dll.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs13
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs10
2 files changed, 16 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index b1e551c..977dcbe 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -177,6 +177,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
177 if (m_log.IsDebugEnabled) 177 if (m_log.IsDebugEnabled)
178 { 178 {
179 m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", LogHeader); 179 m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", LogHeader);
180 // the handle is saved to it doesn't get freed after this call
180 m_DebugLogCallbackHandle = new BulletSimAPI.DebugLogCallback(BulletLogger); 181 m_DebugLogCallbackHandle = new BulletSimAPI.DebugLogCallback(BulletLogger);
181 BulletSimAPI.SetDebugLogCallback(m_DebugLogCallbackHandle); 182 BulletSimAPI.SetDebugLogCallback(m_DebugLogCallbackHandle);
182 } 183 }
@@ -185,7 +186,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
185 186
186 mesher = meshmerizer; 187 mesher = meshmerizer;
187 // The bounding box for the simulated world 188 // The bounding box for the simulated world
188 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, 4096f); 189 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, 8192f);
189 190
190 // m_log.DebugFormat("{0}: Initialize: Calling BulletSimAPI.Initialize.", LogHeader); 191 // m_log.DebugFormat("{0}: Initialize: Calling BulletSimAPI.Initialize.", LogHeader);
191 m_worldID = BulletSimAPI.Initialize(worldExtent, m_paramsHandle.AddrOfPinnedObject(), 192 m_worldID = BulletSimAPI.Initialize(worldExtent, m_paramsHandle.AddrOfPinnedObject(),
@@ -233,7 +234,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
233 parms.terrainFriction = 0.5f; 234 parms.terrainFriction = 0.5f;
234 parms.terrainHitFraction = 0.8f; 235 parms.terrainHitFraction = 0.8f;
235 parms.terrainRestitution = 0f; 236 parms.terrainRestitution = 0f;
236 parms.avatarFriction = 0.0f; 237 parms.avatarFriction = 0.5f;
237 parms.avatarDensity = 60f; 238 parms.avatarDensity = 60f;
238 parms.avatarCapsuleRadius = 0.37f; 239 parms.avatarCapsuleRadius = 0.37f;
239 parms.avatarCapsuleHeight = 1.5f; // 2.140599f 240 parms.avatarCapsuleHeight = 1.5f; // 2.140599f
@@ -716,6 +717,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
716 // new PhysParameterEntry("CcdSweptSphereRadius", "" ), 717 // new PhysParameterEntry("CcdSweptSphereRadius", "" ),
717 new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ), 718 new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ),
718 719
720 new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ),
721 new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ),
722
719 new PhysParameterEntry("TerrainFriction", "Factor to reduce movement against terrain surface" ), 723 new PhysParameterEntry("TerrainFriction", "Factor to reduce movement against terrain surface" ),
720 new PhysParameterEntry("TerrainHitFraction", "Distance to measure hit collisions" ), 724 new PhysParameterEntry("TerrainHitFraction", "Distance to measure hit collisions" ),
721 new PhysParameterEntry("TerrainRestitution", "Bouncyness" ), 725 new PhysParameterEntry("TerrainRestitution", "Bouncyness" ),
@@ -756,7 +760,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
756 case "defaultdensity": m_params[0].defaultDensity = val; break; 760 case "defaultdensity": m_params[0].defaultDensity = val; break;
757 case "defaultrestitution": m_params[0].defaultRestitution = val; break; 761 case "defaultrestitution": m_params[0].defaultRestitution = val; break;
758 case "collisionmargin": m_params[0].collisionMargin = val; break; 762 case "collisionmargin": m_params[0].collisionMargin = val; break;
759 case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, PhysParameterEntry.APPLY_TO_NONE, val); break; 763 case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, localID, val); break;
760 764
761 case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break; 765 case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break;
762 case "angulardamping": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break; 766 case "angulardamping": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break;
@@ -767,6 +771,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
767 case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break; 771 case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break;
768 case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break; 772 case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break;
769 773
774 case "friction": TaintedUpdateParameter(lparm, localID, val); break;
775 case "restitution": TaintedUpdateParameter(lparm, localID, val); break;
776
770 // set a terrain physical feature and cause terrain to be recalculated 777 // set a terrain physical feature and cause terrain to be recalculated
771 case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break; 778 case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break;
772 case "terrainhitfraction": m_params[0].terrainHitFraction = val; TaintedUpdateParameter("terrain", 0, val); break; 779 case "terrainhitfraction": m_params[0].terrainHitFraction = val; TaintedUpdateParameter("terrain", 0, val); break;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index d12bd7d..aab0994 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -149,16 +149,16 @@ public static extern uint Initialize(Vector3 maxPosition, IntPtr parms,
149 int maxUpdates, IntPtr updateArray); 149 int maxUpdates, IntPtr updateArray);
150 150
151[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 151[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
152public static extern bool UpdateParameter(uint worldID, uint localID,
153 [MarshalAs(UnmanagedType.LPStr)]string paramCode, float value);
154
155[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
156public static extern void SetHeightmap(uint worldID, [MarshalAs(UnmanagedType.LPArray)] float[] heightMap); 152public static extern void SetHeightmap(uint worldID, [MarshalAs(UnmanagedType.LPArray)] float[] heightMap);
157 153
158[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 154[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
159public static extern void Shutdown(uint worldID); 155public static extern void Shutdown(uint worldID);
160 156
157[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
158public static extern bool UpdateParameter(uint worldID, uint localID,
159 [MarshalAs(UnmanagedType.LPStr)]string paramCode, float value);
161 160
161// ===============================================================================
162[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 162[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
163public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep, 163public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep,
164 out int updatedEntityCount, 164 out int updatedEntityCount,
@@ -240,6 +240,7 @@ public static extern bool HasObject(uint worldID, uint id);
240[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 240[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
241public static extern bool DestroyObject(uint worldID, uint id); 241public static extern bool DestroyObject(uint worldID, uint id);
242 242
243// ===============================================================================
243[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 244[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
244public static extern SweepHit ConvexSweepTest(uint worldID, uint id, Vector3 to, float extraMargin); 245public static extern SweepHit ConvexSweepTest(uint worldID, uint id, Vector3 to, float extraMargin);
245 246
@@ -249,6 +250,7 @@ public static extern RaycastHit RayTest(uint worldID, uint id, Vector3 from, Vec
249[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 250[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
250public static extern Vector3 RecoverFromPenetration(uint worldID, uint id); 251public static extern Vector3 RecoverFromPenetration(uint worldID, uint id);
251 252
253// ===============================================================================
252[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 254[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
253public static extern void DumpBulletStatistics(); 255public static extern void DumpBulletStatistics();
254 256