aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
diff options
context:
space:
mode:
authorRobert Adams2012-10-12 16:03:03 -0700
committerRobert Adams2012-10-19 10:51:58 -0700
commitfd7a097849b8a405bdd62cfe6d4ee2bbf0a3961c (patch)
tree93606a507aa16538a73e10956735a66f4306fe18 /OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
parentminor: Increase attachment name field from 36 to 50 chars in "attachments sho... (diff)
downloadopensim-SC_OLD-fd7a097849b8a405bdd62cfe6d4ee2bbf0a3961c.zip
opensim-SC_OLD-fd7a097849b8a405bdd62cfe6d4ee2bbf0a3961c.tar.gz
opensim-SC_OLD-fd7a097849b8a405bdd62cfe6d4ee2bbf0a3961c.tar.bz2
opensim-SC_OLD-fd7a097849b8a405bdd62cfe6d4ee2bbf0a3961c.tar.xz
BulletSim: Update BSCharacter to use API2 interface.
Add capsule shape to BSShapeCollection(). Remember last updated values so inter frame diffs can be computed. Parameterize avatarStandingFriction and reduce to 10 from 999. The latter high value made avatars very hard to push. Set CCD parameters for prims and characters of specified.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs21
1 files changed, 16 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 2c3c481..5158011 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -256,10 +256,10 @@ public class BSScene : PhysicsScene, IPhysicsParameters
256 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); 256 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
257 257
258 // m_log.DebugFormat("{0}: Initialize: Calling BulletSimAPI.Initialize.", LogHeader); 258 // m_log.DebugFormat("{0}: Initialize: Calling BulletSimAPI.Initialize.", LogHeader);
259 WorldID = BulletSimAPI.Initialize(worldExtent, m_paramsHandle.AddrOfPinnedObject(), 259 World = new BulletSim(0, this, BulletSimAPI.Initialize2(worldExtent, m_paramsHandle.AddrOfPinnedObject(),
260 m_maxCollisionsPerFrame, m_collisionArrayPinnedHandle.AddrOfPinnedObject(), 260 m_maxCollisionsPerFrame, m_collisionArrayPinnedHandle.AddrOfPinnedObject(),
261 m_maxUpdatesPerFrame, m_updateArrayPinnedHandle.AddrOfPinnedObject(), 261 m_maxUpdatesPerFrame, m_updateArrayPinnedHandle.AddrOfPinnedObject(),
262 m_DebugLogCallbackHandle); 262 m_DebugLogCallbackHandle));
263 263
264 // Initialization to support the transition to a new API which puts most of the logic 264 // Initialization to support the transition to a new API which puts most of the logic
265 // into the C# code so it is easier to modify and add to. 265 // into the C# code so it is easier to modify and add to.
@@ -360,7 +360,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
360 } 360 }
361 361
362 // Anything left in the unmanaged code should be cleaned out 362 // Anything left in the unmanaged code should be cleaned out
363 BulletSimAPI.Shutdown(WorldID); 363 BulletSimAPI.Shutdown2(World.ptr);
364 364
365 // Not logging any more 365 // Not logging any more
366 PhysicsLogging.Close(); 366 PhysicsLogging.Close();
@@ -498,7 +498,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
498 { 498 {
499 if (PhysicsLogging.Enabled) beforeTime = Util.EnvironmentTickCount(); 499 if (PhysicsLogging.Enabled) beforeTime = Util.EnvironmentTickCount();
500 500
501 numSubSteps = BulletSimAPI.PhysicsStep(WorldID, timeStep, m_maxSubSteps, m_fixedTimeStep, 501 numSubSteps = BulletSimAPI.PhysicsStep2(World.ptr, timeStep, m_maxSubSteps, m_fixedTimeStep,
502 out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr); 502 out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr);
503 503
504 if (PhysicsLogging.Enabled) simTime = Util.EnvironmentTickCountSubtract(beforeTime); 504 if (PhysicsLogging.Enabled) simTime = Util.EnvironmentTickCountSubtract(beforeTime);
@@ -1011,6 +1011,11 @@ public class BSScene : PhysicsScene, IPhysicsParameters
1011 (s,cf,p,v) => { s.m_params[0].avatarFriction = cf.GetFloat(p, v); }, 1011 (s,cf,p,v) => { s.m_params[0].avatarFriction = cf.GetFloat(p, v); },
1012 (s) => { return s.m_params[0].avatarFriction; }, 1012 (s) => { return s.m_params[0].avatarFriction; },
1013 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].avatarFriction, p, l, v); } ), 1013 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].avatarFriction, p, l, v); } ),
1014 new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.",
1015 10f,
1016 (s,cf,p,v) => { s.m_params[0].avatarStandingFriction = cf.GetFloat(p, v); },
1017 (s) => { return s.m_params[0].avatarStandingFriction; },
1018 (s,p,l,v) => { s.m_params[0].avatarStandingFriction = v; } ),
1014 new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", 1019 new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.",
1015 60f, 1020 60f,
1016 (s,cf,p,v) => { s.m_params[0].avatarDensity = cf.GetFloat(p, v); }, 1021 (s,cf,p,v) => { s.m_params[0].avatarDensity = cf.GetFloat(p, v); },
@@ -1246,7 +1251,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
1246 case PhysParameterEntry.APPLY_TO_NONE: 1251 case PhysParameterEntry.APPLY_TO_NONE:
1247 defaultLoc = val; // setting only the default value 1252 defaultLoc = val; // setting only the default value
1248 break; 1253 break;
1249 case PhysParameterEntry.APPLY_TO_ALL: 1254 case PhysParameterEntry.APPLY_TO_ALL:
1255 m_log.ErrorFormat("{0} Cannot change parameters of multiple objects. Someday it will be added.", LogHeader);
1256 /*
1250 defaultLoc = val; // setting ALL also sets the default value 1257 defaultLoc = val; // setting ALL also sets the default value
1251 List<uint> objectIDs = lIDs; 1258 List<uint> objectIDs = lIDs;
1252 string xparm = parm.ToLower(); 1259 string xparm = parm.ToLower();
@@ -1257,6 +1264,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
1257 BulletSimAPI.UpdateParameter(WorldID, lID, xparm, xval); 1264 BulletSimAPI.UpdateParameter(WorldID, lID, xparm, xval);
1258 } 1265 }
1259 }); 1266 });
1267 */
1260 break; 1268 break;
1261 default: 1269 default:
1262 // setting only one localID 1270 // setting only one localID
@@ -1268,12 +1276,15 @@ public class BSScene : PhysicsScene, IPhysicsParameters
1268 // schedule the actual updating of the paramter to when the phys engine is not busy 1276 // schedule the actual updating of the paramter to when the phys engine is not busy
1269 protected void TaintedUpdateParameter(string parm, uint localID, float val) 1277 protected void TaintedUpdateParameter(string parm, uint localID, float val)
1270 { 1278 {
1279 m_log.ErrorFormat("{0} Cannot change parameters of base objects. Someday it will be added.", LogHeader);
1280 /*
1271 uint xlocalID = localID; 1281 uint xlocalID = localID;
1272 string xparm = parm.ToLower(); 1282 string xparm = parm.ToLower();
1273 float xval = val; 1283 float xval = val;
1274 TaintedObject("BSScene.TaintedUpdateParameter", delegate() { 1284 TaintedObject("BSScene.TaintedUpdateParameter", delegate() {
1275 BulletSimAPI.UpdateParameter(WorldID, xlocalID, xparm, xval); 1285 BulletSimAPI.UpdateParameter(WorldID, xlocalID, xparm, xval);
1276 }); 1286 });
1287 */
1277 } 1288 }
1278 1289
1279 // Get parameter. 1290 // Get parameter.