diff options
author | Robert Adams | 2012-10-14 19:23:35 -0700 |
---|---|---|
committer | Robert Adams | 2012-10-19 10:52:06 -0700 |
commit | eaccfa6d99ac51b4963ae0fa457ff0d2b9ce65e7 (patch) | |
tree | 3fb006e93c8599a124369b2b4da16c72fea540ec /OpenSim | |
parent | BulletSim: Update BSCharacter to use API2 interface. (diff) | |
download | opensim-SC_OLD-eaccfa6d99ac51b4963ae0fa457ff0d2b9ce65e7.zip opensim-SC_OLD-eaccfa6d99ac51b4963ae0fa457ff0d2b9ce65e7.tar.gz opensim-SC_OLD-eaccfa6d99ac51b4963ae0fa457ff0d2b9ce65e7.tar.bz2 opensim-SC_OLD-eaccfa6d99ac51b4963ae0fa457ff0d2b9ce65e7.tar.xz |
BulletSim: Fix small problems with last patch: BSScene.World properly initialized and setting of C++ parameters commented out. Comments and logging added.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 13 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 2 |
3 files changed, 6 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 7c2f856..7bc6b69 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -146,7 +146,7 @@ public class BSCharacter : BSPhysObject | |||
146 | 146 | ||
147 | ZeroMotion(); | 147 | ZeroMotion(); |
148 | 148 | ||
149 | OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSBody.ptr, MassRaw); | 149 | OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, MassRaw); |
150 | BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia); | 150 | BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia); |
151 | 151 | ||
152 | // Set the velocity and compute the proper friction | 152 | // Set the velocity and compute the proper friction |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 5158011..7998b08 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -261,10 +261,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
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 | ||
265 | // into the C# code so it is easier to modify and add to. | ||
266 | World = new BulletSim(WorldID, this, BulletSimAPI.GetSimHandle2(WorldID)); | ||
267 | |||
268 | Constraints = new BSConstraintCollection(World); | 264 | Constraints = new BSConstraintCollection(World); |
269 | 265 | ||
270 | TerrainManager = new BSTerrainManager(this); | 266 | TerrainManager = new BSTerrainManager(this); |
@@ -1251,10 +1247,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
1251 | case PhysParameterEntry.APPLY_TO_NONE: | 1247 | case PhysParameterEntry.APPLY_TO_NONE: |
1252 | defaultLoc = val; // setting only the default value | 1248 | defaultLoc = val; // setting only the default value |
1253 | break; | 1249 | break; |
1254 | case PhysParameterEntry.APPLY_TO_ALL: | 1250 | case PhysParameterEntry.APPLY_TO_ALL: |
1255 | m_log.ErrorFormat("{0} Cannot change parameters of multiple objects. Someday it will be added.", LogHeader); | ||
1256 | /* | ||
1257 | defaultLoc = val; // setting ALL also sets the default value | 1251 | defaultLoc = val; // setting ALL also sets the default value |
1252 | /* | ||
1258 | List<uint> objectIDs = lIDs; | 1253 | List<uint> objectIDs = lIDs; |
1259 | string xparm = parm.ToLower(); | 1254 | string xparm = parm.ToLower(); |
1260 | float xval = val; | 1255 | float xval = val; |
@@ -1276,15 +1271,15 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
1276 | // schedule the actual updating of the paramter to when the phys engine is not busy | 1271 | // schedule the actual updating of the paramter to when the phys engine is not busy |
1277 | protected void TaintedUpdateParameter(string parm, uint localID, float val) | 1272 | protected void TaintedUpdateParameter(string parm, uint localID, float val) |
1278 | { | 1273 | { |
1274 | /* Settings in the C++ code are not working at the moment. TODO: fix the settings. | ||
1279 | m_log.ErrorFormat("{0} Cannot change parameters of base objects. Someday it will be added.", LogHeader); | 1275 | m_log.ErrorFormat("{0} Cannot change parameters of base objects. Someday it will be added.", LogHeader); |
1280 | /* | ||
1281 | uint xlocalID = localID; | 1276 | uint xlocalID = localID; |
1282 | string xparm = parm.ToLower(); | 1277 | string xparm = parm.ToLower(); |
1283 | float xval = val; | 1278 | float xval = val; |
1284 | TaintedObject("BSScene.TaintedUpdateParameter", delegate() { | 1279 | TaintedObject("BSScene.TaintedUpdateParameter", delegate() { |
1285 | BulletSimAPI.UpdateParameter(WorldID, xlocalID, xparm, xval); | 1280 | BulletSimAPI.UpdateParameter(WorldID, xlocalID, xparm, xval); |
1286 | }); | 1281 | }); |
1287 | */ | 1282 | */ |
1288 | } | 1283 | } |
1289 | 1284 | ||
1290 | // Get parameter. | 1285 | // Get parameter. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 7d0f84a..5a77e52 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -369,6 +369,7 @@ public class BSShapeCollection : IDisposable | |||
369 | // an avatar capsule is close to a native shape (it is not shared) | 369 | // an avatar capsule is close to a native shape (it is not shared) |
370 | ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_AVATAR, | 370 | ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_AVATAR, |
371 | ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback); | 371 | ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback); |
372 | DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.BSShape); | ||
372 | haveShape = true; | 373 | haveShape = true; |
373 | } | 374 | } |
374 | // If the prim attributes are simple, this could be a simple Bullet native shape | 375 | // If the prim attributes are simple, this could be a simple Bullet native shape |
@@ -460,7 +461,6 @@ public class BSShapeCollection : IDisposable | |||
460 | } | 461 | } |
461 | else | 462 | else |
462 | { | 463 | { |
463 | // Native shapes are always built independently. | ||
464 | newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, shapeData), shapeType); | 464 | newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, shapeData), shapeType); |
465 | newShape.shapeKey = (System.UInt64)shapeKey; | 465 | newShape.shapeKey = (System.UInt64)shapeKey; |
466 | newShape.isNativeShape = true; | 466 | newShape.isNativeShape = true; |