BulletSim: Fix small problems with last patch: BSScene.World properly initialized and setting of C++ parameters commented out. Comments and logging added.
parent
fd7a097849
commit
eaccfa6d99
|
@ -146,7 +146,7 @@ public class BSCharacter : BSPhysObject
|
||||||
|
|
||||||
ZeroMotion();
|
ZeroMotion();
|
||||||
|
|
||||||
OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSBody.ptr, MassRaw);
|
OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, MassRaw);
|
||||||
BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia);
|
BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia);
|
||||||
|
|
||||||
// Set the velocity and compute the proper friction
|
// Set the velocity and compute the proper friction
|
||||||
|
|
|
@ -261,10 +261,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
m_maxUpdatesPerFrame, m_updateArrayPinnedHandle.AddrOfPinnedObject(),
|
m_maxUpdatesPerFrame, m_updateArrayPinnedHandle.AddrOfPinnedObject(),
|
||||||
m_DebugLogCallbackHandle));
|
m_DebugLogCallbackHandle));
|
||||||
|
|
||||||
// Initialization to support the transition to a new API which puts most of the logic
|
|
||||||
// into the C# code so it is easier to modify and add to.
|
|
||||||
World = new BulletSim(WorldID, this, BulletSimAPI.GetSimHandle2(WorldID));
|
|
||||||
|
|
||||||
Constraints = new BSConstraintCollection(World);
|
Constraints = new BSConstraintCollection(World);
|
||||||
|
|
||||||
TerrainManager = new BSTerrainManager(this);
|
TerrainManager = new BSTerrainManager(this);
|
||||||
|
@ -1251,10 +1247,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
case PhysParameterEntry.APPLY_TO_NONE:
|
case PhysParameterEntry.APPLY_TO_NONE:
|
||||||
defaultLoc = val; // setting only the default value
|
defaultLoc = val; // setting only the default value
|
||||||
break;
|
break;
|
||||||
case PhysParameterEntry.APPLY_TO_ALL:
|
case PhysParameterEntry.APPLY_TO_ALL:
|
||||||
m_log.ErrorFormat("{0} Cannot change parameters of multiple objects. Someday it will be added.", LogHeader);
|
|
||||||
/*
|
|
||||||
defaultLoc = val; // setting ALL also sets the default value
|
defaultLoc = val; // setting ALL also sets the default value
|
||||||
|
/*
|
||||||
List<uint> objectIDs = lIDs;
|
List<uint> objectIDs = lIDs;
|
||||||
string xparm = parm.ToLower();
|
string xparm = parm.ToLower();
|
||||||
float xval = val;
|
float xval = val;
|
||||||
|
@ -1276,15 +1271,15 @@ public class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
// schedule the actual updating of the paramter to when the phys engine is not busy
|
// schedule the actual updating of the paramter to when the phys engine is not busy
|
||||||
protected void TaintedUpdateParameter(string parm, uint localID, float val)
|
protected void TaintedUpdateParameter(string parm, uint localID, float val)
|
||||||
{
|
{
|
||||||
|
/* Settings in the C++ code are not working at the moment. TODO: fix the settings.
|
||||||
m_log.ErrorFormat("{0} Cannot change parameters of base objects. Someday it will be added.", LogHeader);
|
m_log.ErrorFormat("{0} Cannot change parameters of base objects. Someday it will be added.", LogHeader);
|
||||||
/*
|
|
||||||
uint xlocalID = localID;
|
uint xlocalID = localID;
|
||||||
string xparm = parm.ToLower();
|
string xparm = parm.ToLower();
|
||||||
float xval = val;
|
float xval = val;
|
||||||
TaintedObject("BSScene.TaintedUpdateParameter", delegate() {
|
TaintedObject("BSScene.TaintedUpdateParameter", delegate() {
|
||||||
BulletSimAPI.UpdateParameter(WorldID, xlocalID, xparm, xval);
|
BulletSimAPI.UpdateParameter(WorldID, xlocalID, xparm, xval);
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get parameter.
|
// Get parameter.
|
||||||
|
|
|
@ -369,6 +369,7 @@ public class BSShapeCollection : IDisposable
|
||||||
// an avatar capsule is close to a native shape (it is not shared)
|
// an avatar capsule is close to a native shape (it is not shared)
|
||||||
ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_AVATAR,
|
ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_AVATAR,
|
||||||
ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback);
|
ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback);
|
||||||
|
DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.BSShape);
|
||||||
haveShape = true;
|
haveShape = true;
|
||||||
}
|
}
|
||||||
// If the prim attributes are simple, this could be a simple Bullet native shape
|
// If the prim attributes are simple, this could be a simple Bullet native shape
|
||||||
|
@ -460,7 +461,6 @@ public class BSShapeCollection : IDisposable
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Native shapes are always built independently.
|
|
||||||
newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, shapeData), shapeType);
|
newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, shapeData), shapeType);
|
||||||
newShape.shapeKey = (System.UInt64)shapeKey;
|
newShape.shapeKey = (System.UInt64)shapeKey;
|
||||||
newShape.isNativeShape = true;
|
newShape.isNativeShape = true;
|
||||||
|
|
Loading…
Reference in New Issue