BulletSim: remove trailing white space to make git happier. No functional changes.
parent
ad1787770e
commit
92ee288d66
|
@ -75,7 +75,7 @@ private sealed class BulletBodyUnman : BulletBody
|
|||
private sealed class BulletShapeUnman : BulletShape
|
||||
{
|
||||
public IntPtr ptr;
|
||||
public BulletShapeUnman(IntPtr xx, BSPhysicsShapeType typ)
|
||||
public BulletShapeUnman(IntPtr xx, BSPhysicsShapeType typ)
|
||||
: base()
|
||||
{
|
||||
ptr = xx;
|
||||
|
@ -255,7 +255,7 @@ public override BulletShape CreateHullShape(BulletWorld world, int hullCount, fl
|
|||
{
|
||||
BulletWorldUnman worldu = world as BulletWorldUnman;
|
||||
return new BulletShapeUnman(
|
||||
BSAPICPP.CreateHullShape2(worldu.ptr, hullCount, hulls),
|
||||
BSAPICPP.CreateHullShape2(worldu.ptr, hullCount, hulls),
|
||||
BSPhysicsShapeType.SHAPE_HULL);
|
||||
}
|
||||
|
||||
|
@ -1503,7 +1503,7 @@ public static extern void DestroyObject2(IntPtr sim, IntPtr obj);
|
|||
public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin);
|
||||
|
||||
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
public static extern IntPtr CreateTerrainShape2(uint id, Vector3 size, float minHeight, float maxHeight,
|
||||
public static extern IntPtr CreateTerrainShape2(uint id, Vector3 size, float minHeight, float maxHeight,
|
||||
[MarshalAs(UnmanagedType.LPArray)] float[] heightMap,
|
||||
float scaleFactor, float collisionMargin);
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ private sealed class BulletBodyXNA : BulletBody
|
|||
private sealed class BulletShapeXNA : BulletShape
|
||||
{
|
||||
public CollisionShape shape;
|
||||
public BulletShapeXNA(CollisionShape xx, BSPhysicsShapeType typ)
|
||||
public BulletShapeXNA(CollisionShape xx, BSPhysicsShapeType typ)
|
||||
: base()
|
||||
{
|
||||
shape = xx;
|
||||
|
@ -137,8 +137,8 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
internal int LastEntityProperty = 0;
|
||||
|
||||
internal EntityProperties[] UpdatedObjects;
|
||||
internal Dictionary<uint, GhostObject> specialCollisionObjects;
|
||||
|
||||
internal Dictionary<uint, GhostObject> specialCollisionObjects;
|
||||
|
||||
private static int m_collisionsThisFrame;
|
||||
private BSScene PhysicsScene { get; set; }
|
||||
|
||||
|
@ -151,7 +151,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="p"></param>
|
||||
/// <param name="p_2"></param>
|
||||
|
@ -174,7 +174,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world;
|
||||
TypedConstraint constraint = (pConstraint as BulletConstraintXNA).constrain;
|
||||
world.AddConstraint(constraint, pDisableCollisionsBetweenLinkedObjects);
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
public override bool GetForceUpdateAllAabbs(BulletWorld pWorld) {
|
||||
DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world;
|
||||
return world.GetForceUpdateAllAabbs();
|
||||
|
||||
|
||||
}
|
||||
public override void SetForceUpdateAllAabbs(BulletWorld pWorld, bool pForce)
|
||||
{
|
||||
|
@ -404,7 +404,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
IndexedMatrix mat = IndexedMatrix.CreateFromQuaternion(vquaternion);
|
||||
mat._origin = vposition;
|
||||
collisionObject.SetWorldTransform(mat);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override Vector3 GetPosition(BulletBody pCollisionObject)
|
||||
|
@ -457,7 +457,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
{
|
||||
CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).rigidBody;
|
||||
collisionObject.Activate(pforceactivation);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override Quaternion GetOrientation(BulletBody pCollisionObject)
|
||||
|
@ -486,7 +486,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
{
|
||||
CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).rigidBody;
|
||||
return collisionObject.GetCcdSweptSphereRadius();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override IntPtr GetUserPointer(BulletBody pCollisionObject)
|
||||
|
@ -559,8 +559,8 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
}
|
||||
|
||||
|
||||
public override BulletConstraint Create6DofConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2,
|
||||
Vector3 pframe1, Quaternion pframe1rot, Vector3 pframe2, Quaternion pframe2rot,
|
||||
public override BulletConstraint Create6DofConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2,
|
||||
Vector3 pframe1, Quaternion pframe1rot, Vector3 pframe2, Quaternion pframe2rot,
|
||||
bool puseLinearReferenceFrameA, bool pdisableCollisionsBetweenLinkedBodies)
|
||||
|
||||
{
|
||||
|
@ -604,7 +604,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="pWorld"></param>
|
||||
/// <param name="pBody1"></param>
|
||||
|
@ -824,7 +824,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
{
|
||||
RigidBody body = (pBody as BulletBodyXNA).rigidBody;
|
||||
float angularDamping = body.GetAngularDamping();
|
||||
body.SetDamping(lin_damping, angularDamping);
|
||||
body.SetDamping(lin_damping, angularDamping);
|
||||
}
|
||||
|
||||
public override float GetLinearDamping(BulletBody pBody)
|
||||
|
@ -907,7 +907,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
RigidBody bo = co as RigidBody;
|
||||
if (bo == null)
|
||||
{
|
||||
|
||||
|
||||
if (world.IsInWorld(co))
|
||||
{
|
||||
world.RemoveCollisionObject(co);
|
||||
|
@ -915,7 +915,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
if (world.IsInWorld(bo))
|
||||
{
|
||||
world.RemoveRigidBody(bo);
|
||||
|
@ -947,7 +947,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
|
||||
// TODO: Turn this from a reference copy to a Value Copy.
|
||||
BulletShapeXNA shape2 = new BulletShapeXNA(shape1, BSShapeTypeFromBroadPhaseNativeType(shape1.GetShapeType()));
|
||||
|
||||
|
||||
return shape2;
|
||||
}
|
||||
|
||||
|
@ -957,7 +957,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
return false;
|
||||
}
|
||||
//(sim.ptr, shape.ptr, prim.LocalID, prim.RawPosition, prim.RawOrientation);
|
||||
|
||||
|
||||
public override BulletBody CreateBodyFromShape(BulletWorld pWorld, BulletShape pShape, uint pLocalID, Vector3 pRawPosition, Quaternion pRawOrientation)
|
||||
{
|
||||
CollisionWorld world = (pWorld as BulletWorldXNA).world;
|
||||
|
@ -993,11 +993,11 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
m_startWorldTransform = IndexedMatrix.Identity;
|
||||
*/
|
||||
body.SetUserPointer(pLocalID);
|
||||
|
||||
|
||||
return new BulletBodyXNA(pLocalID, body);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override BulletBody CreateBodyWithDefaultMotionState( BulletShape pShape, uint pLocalID, Vector3 pRawPosition, Quaternion pRawOrientation)
|
||||
{
|
||||
|
||||
|
@ -1025,7 +1025,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
public override Vector3 GetAnisotripicFriction(BulletConstraint pconstrain)
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
/* TODO */
|
||||
return Vector3.Zero;
|
||||
}
|
||||
public override Vector3 SetAnisotripicFriction(BulletConstraint pconstrain, Vector3 frict) { /* TODO */ return Vector3.Zero; }
|
||||
|
@ -1035,7 +1035,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
{
|
||||
CollisionObject collisionObject = (pCollisionObject as BulletBodyXNA).rigidBody;
|
||||
return collisionObject.IsStaticObject();
|
||||
|
||||
|
||||
}
|
||||
public override bool IsKinematicObject(BulletBody pCollisionObject)
|
||||
{
|
||||
|
@ -1098,10 +1098,10 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
return new BulletWorldXNA(1, PhysicsScene, BSAPIXNA.Initialize2(worldExtent, configparms, maxCollisions, ref collisionArray, maxUpdates, ref updateArray, null));
|
||||
}
|
||||
|
||||
private static DiscreteDynamicsWorld Initialize2(Vector3 worldExtent,
|
||||
private static DiscreteDynamicsWorld Initialize2(Vector3 worldExtent,
|
||||
ConfigurationParameters[] o,
|
||||
int mMaxCollisionsPerFrame, ref CollisionDesc[] collisionArray,
|
||||
int mMaxUpdatesPerFrame, ref EntityProperties[] updateArray,
|
||||
int mMaxUpdatesPerFrame, ref EntityProperties[] updateArray,
|
||||
object mDebugLogCallbackHandle)
|
||||
{
|
||||
CollisionWorld.WorldData.ParamData p = new CollisionWorld.WorldData.ParamData();
|
||||
|
@ -1138,9 +1138,9 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
p.avatarCapsuleDepth = BSParam.AvatarCapsuleDepth;
|
||||
p.avatarCapsuleHeight = BSParam.AvatarCapsuleHeight;
|
||||
p.avatarContactProcessingThreshold = BSParam.AvatarContactProcessingThreshold;
|
||||
|
||||
|
||||
p.vehicleAngularDamping = BSParam.VehicleAngularDamping;
|
||||
|
||||
|
||||
p.maxPersistantManifoldPoolSize = o[0].maxPersistantManifoldPoolSize;
|
||||
p.maxCollisionAlgorithmPoolSize = o[0].maxCollisionAlgorithmPoolSize;
|
||||
p.shouldDisableContactPoolDynamicAllocation = o[0].shouldDisableContactPoolDynamicAllocation;
|
||||
|
@ -1160,7 +1160,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
p.linkConstraintSolverIterations = BSParam.LinkConstraintSolverIterations;
|
||||
p.physicsLoggingFrames = o[0].physicsLoggingFrames;
|
||||
DefaultCollisionConstructionInfo ccci = new DefaultCollisionConstructionInfo();
|
||||
|
||||
|
||||
DefaultCollisionConfiguration cci = new DefaultCollisionConfiguration();
|
||||
CollisionDispatcher m_dispatcher = new CollisionDispatcher(cci);
|
||||
|
||||
|
@ -1263,7 +1263,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override float GetAngularMotionDisc(BulletShape pShape)
|
||||
|
@ -1353,10 +1353,10 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
CollisionShape shape = (pShape as BulletShapeXNA).shape;
|
||||
gObj.SetCollisionShape(shape);
|
||||
gObj.SetUserPointer(pLocalID);
|
||||
|
||||
|
||||
if (specialCollisionObjects.ContainsKey(pLocalID))
|
||||
specialCollisionObjects[pLocalID] = gObj;
|
||||
else
|
||||
else
|
||||
specialCollisionObjects.Add(pLocalID, gObj);
|
||||
|
||||
// TODO: Add to Special CollisionObjects!
|
||||
|
@ -1447,8 +1447,8 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
return new BulletShapeXNA(ret, BSShapeTypeFromBroadPhaseNativeType(ret.GetShapeType()));
|
||||
}
|
||||
|
||||
public override BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx) {
|
||||
|
||||
public override BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx) {
|
||||
|
||||
if (cShape == null)
|
||||
return null;
|
||||
CompoundShape compoundShape = (cShape as BulletShapeXNA).shape as CompoundShape;
|
||||
|
@ -1456,7 +1456,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
BulletShape retShape = new BulletShapeXNA(shape, BSShapeTypeFromBroadPhaseNativeType(shape.GetShapeType()));
|
||||
|
||||
|
||||
return retShape;
|
||||
return retShape;
|
||||
}
|
||||
|
||||
public BSPhysicsShapeType BSShapeTypeFromBroadPhaseNativeType(BroadphaseNativeTypes pin)
|
||||
|
@ -1598,8 +1598,8 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
return new BulletShapeXNA(m_planeshape, BSPhysicsShapeType.SHAPE_GROUNDPLANE);
|
||||
}
|
||||
|
||||
public override BulletConstraint Create6DofSpringConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2,
|
||||
Vector3 pframe1, Quaternion pframe1rot, Vector3 pframe2, Quaternion pframe2rot,
|
||||
public override BulletConstraint Create6DofSpringConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2,
|
||||
Vector3 pframe1, Quaternion pframe1rot, Vector3 pframe2, Quaternion pframe2rot,
|
||||
bool puseLinearReferenceFrameA, bool pdisableCollisionsBetweenLinkedBodies)
|
||||
|
||||
{
|
||||
|
@ -1745,7 +1745,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
{
|
||||
DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world;
|
||||
CompoundShape compoundshape = new CompoundShape(false);
|
||||
|
||||
|
||||
compoundshape.SetMargin(world.WorldSettings.Params.collisionMargin);
|
||||
int ii = 1;
|
||||
|
||||
|
@ -1761,7 +1761,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
int ender = ((ii + 4) + (vertexCount*3));
|
||||
for (int iii = ii + 4; iii < ender; iii+=3)
|
||||
{
|
||||
|
||||
|
||||
virts.Add(new IndexedVector3(pConvHulls[iii], pConvHulls[iii + 1], pConvHulls[iii +2]));
|
||||
}
|
||||
ConvexHullShape convexShape = new ConvexHullShape(virts, vertexCount);
|
||||
|
@ -1769,7 +1769,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
compoundshape.AddChildShape(ref childTrans, convexShape);
|
||||
ii += (vertexCount*3 + 4);
|
||||
}
|
||||
|
||||
|
||||
return new BulletShapeXNA(compoundshape, BSPhysicsShapeType.SHAPE_HULL);
|
||||
}
|
||||
|
||||
|
@ -1791,13 +1791,13 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
public override BulletShape CreateMeshShape(BulletWorld pWorld, int pIndicesCount, int[] indices, int pVerticesCount, float[] verticesAsFloats)
|
||||
{
|
||||
//DumpRaw(indices,verticesAsFloats,pIndicesCount,pVerticesCount);
|
||||
|
||||
|
||||
for (int iter = 0; iter < pVerticesCount; iter++)
|
||||
{
|
||||
if (verticesAsFloats[iter] > 0 && verticesAsFloats[iter] < 0.0001) verticesAsFloats[iter] = 0;
|
||||
if (verticesAsFloats[iter] < 0 && verticesAsFloats[iter] > -0.0001) verticesAsFloats[iter] = 0;
|
||||
}
|
||||
|
||||
|
||||
ObjectArray<int> indicesarr = new ObjectArray<int>(indices);
|
||||
ObjectArray<float> vertices = new ObjectArray<float>(verticesAsFloats);
|
||||
DumpRaw(indicesarr,vertices,pIndicesCount,pVerticesCount);
|
||||
|
@ -1811,7 +1811,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
mesh.m_vertexStride = 3;
|
||||
mesh.m_vertexType = PHY_ScalarType.PHY_FLOAT;
|
||||
mesh.m_triangleIndexStride = 3;
|
||||
|
||||
|
||||
TriangleIndexVertexArray tribuilder = new TriangleIndexVertexArray();
|
||||
tribuilder.AddIndexedMesh(mesh, PHY_ScalarType.PHY_INTEGER);
|
||||
BvhTriangleMeshShape meshShape = new BvhTriangleMeshShape(tribuilder, true,true);
|
||||
|
@ -1822,7 +1822,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
}
|
||||
public static void DumpRaw(ObjectArray<int>indices, ObjectArray<float> vertices, int pIndicesCount,int pVerticesCount )
|
||||
{
|
||||
|
||||
|
||||
String fileName = "objTest3.raw";
|
||||
String completePath = System.IO.Path.Combine(Util.configDir(), fileName);
|
||||
StreamWriter sw = new StreamWriter(completePath);
|
||||
|
@ -1848,7 +1848,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
string s = vertices[indices[i * 3]].ToString("0.0000");
|
||||
s += " " + vertices[indices[i * 3 + 1]].ToString("0.0000");
|
||||
s += " " + vertices[indices[i * 3 + 2]].ToString("0.0000");
|
||||
|
||||
|
||||
sw.Write(s + "\n");
|
||||
}
|
||||
|
||||
|
@ -1870,7 +1870,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
mesh.m_vertexStride = 3;
|
||||
mesh.m_vertexType = PHY_ScalarType.PHY_FLOAT;
|
||||
mesh.m_triangleIndexStride = 3;
|
||||
|
||||
|
||||
TriangleIndexVertexArray tribuilder = new TriangleIndexVertexArray();
|
||||
tribuilder.AddIndexedMesh(mesh, PHY_ScalarType.PHY_INTEGER);
|
||||
|
||||
|
@ -1901,7 +1901,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
sw.Close();
|
||||
}
|
||||
|
||||
public override BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
|
||||
public override BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
|
||||
float scaleFactor, float collisionMargin)
|
||||
{
|
||||
const int upAxis = 2;
|
||||
|
@ -1943,14 +1943,14 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
/* TODO */
|
||||
updatedEntityCount = 0;
|
||||
collidersCount = 0;
|
||||
|
||||
|
||||
|
||||
int ret = PhysicsStep2(world,timeStep,maxSubSteps,fixedTimeStep,out updatedEntityCount,out world.physicsScene.m_updateArray, out collidersCount, out world.physicsScene.m_collisionArray);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private int PhysicsStep2(BulletWorld pWorld, float timeStep, int m_maxSubSteps, float m_fixedTimeStep,
|
||||
private int PhysicsStep2(BulletWorld pWorld, float timeStep, int m_maxSubSteps, float m_fixedTimeStep,
|
||||
out int updatedEntityCount, out EntityProperties[] updatedEntities,
|
||||
out int collidersCount, out CollisionDesc[] colliders)
|
||||
{
|
||||
|
@ -1959,24 +1959,24 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
return epic;
|
||||
}
|
||||
|
||||
private int PhysicsStepint(BulletWorld pWorld,float timeStep, int m_maxSubSteps, float m_fixedTimeStep, out int updatedEntityCount,
|
||||
private int PhysicsStepint(BulletWorld pWorld,float timeStep, int m_maxSubSteps, float m_fixedTimeStep, out int updatedEntityCount,
|
||||
out EntityProperties[] updatedEntities, out int collidersCount, out CollisionDesc[] colliders, int maxCollisions, int maxUpdates)
|
||||
{
|
||||
int numSimSteps = 0;
|
||||
Array.Clear(UpdatedObjects, 0, UpdatedObjects.Length);
|
||||
Array.Clear(UpdatedCollisions, 0, UpdatedCollisions.Length);
|
||||
LastEntityProperty=0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
LastCollisionDesc=0;
|
||||
|
||||
|
||||
updatedEntityCount = 0;
|
||||
collidersCount = 0;
|
||||
|
||||
|
||||
|
||||
if (pWorld is BulletWorldXNA)
|
||||
{
|
||||
|
@ -2033,7 +2033,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
|
||||
collidersCount = LastCollisionDesc;
|
||||
colliders = UpdatedCollisions;
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -2041,15 +2041,15 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
//if (updatedEntities is null)
|
||||
//updatedEntities = new List<BulletXNA.EntityProperties>();
|
||||
//updatedEntityCount = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
//collidersCount = 0;
|
||||
|
||||
|
||||
updatedEntities = new EntityProperties[0];
|
||||
|
||||
|
||||
|
||||
colliders = new CollisionDesc[0];
|
||||
|
||||
|
||||
}
|
||||
return numSimSteps;
|
||||
}
|
||||
|
@ -2057,7 +2057,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
{
|
||||
IOverlappingPairCache cache = obj.GetOverlappingPairCache();
|
||||
ObjectArray<BroadphasePair> pairs = cache.GetOverlappingPairArray();
|
||||
|
||||
|
||||
DiscreteDynamicsWorld world = (PhysicsScene.World as BulletWorldXNA).world;
|
||||
PersistentManifoldArray manifoldArray = new PersistentManifoldArray();
|
||||
BroadphasePair collisionPair;
|
||||
|
@ -2069,7 +2069,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
ManifoldPoint pt;
|
||||
|
||||
int numPairs = pairs.Count;
|
||||
|
||||
|
||||
for (int i = 0; i < numPairs; i++)
|
||||
{
|
||||
manifoldArray.Clear();
|
||||
|
@ -2078,7 +2078,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
collisionPair = world.GetPairCache().FindPair(pairs[i].m_pProxy0, pairs[i].m_pProxy1);
|
||||
if (collisionPair == null)
|
||||
continue;
|
||||
|
||||
|
||||
collisionPair.m_algorithm.GetAllContactManifolds(manifoldArray);
|
||||
for (int j = 0; j < manifoldArray.Count; j++)
|
||||
{
|
||||
|
@ -2101,7 +2101,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
}
|
||||
private static void RecordCollision(BSAPIXNA world, CollisionObject objA, CollisionObject objB, IndexedVector3 contact, IndexedVector3 norm, float penetration)
|
||||
{
|
||||
|
||||
|
||||
IndexedVector3 contactNormal = norm;
|
||||
if ((objA.GetCollisionFlags() & BulletXNA.BulletCollision.CollisionFlags.BS_WANTS_COLLISIONS) == 0 &&
|
||||
(objB.GetCollisionFlags() & BulletXNA.BulletCollision.CollisionFlags.BS_WANTS_COLLISIONS) == 0)
|
||||
|
@ -2171,11 +2171,11 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
if (NotMe is BulletBodyXNA && NotMe.HasPhysicalBody)
|
||||
{
|
||||
CollisionObject AvoidBody = (NotMe as BulletBodyXNA).body;
|
||||
|
||||
|
||||
IndexedVector3 rOrigin = new IndexedVector3(_RayOrigin.X, _RayOrigin.Y, _RayOrigin.Z);
|
||||
IndexedVector3 rEnd = new IndexedVector3(_RayOrigin.X, _RayOrigin.Y, _RayOrigin.Z - pRayHeight);
|
||||
using (
|
||||
ClosestNotMeRayResultCallback rayCallback =
|
||||
ClosestNotMeRayResultCallback rayCallback =
|
||||
new ClosestNotMeRayResultCallback(rOrigin, rEnd, AvoidBody)
|
||||
)
|
||||
{
|
||||
|
@ -2191,9 +2191,9 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class SimMotionState : DefaultMotionState
|
||||
{
|
||||
|
@ -2286,12 +2286,12 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
m_lastProperties = m_properties;
|
||||
if (m_world.LastEntityProperty < m_world.UpdatedObjects.Length)
|
||||
m_world.UpdatedObjects[m_world.LastEntityProperty++]=(m_properties);
|
||||
|
||||
|
||||
//(*m_updatesThisFrame)[m_properties.ID] = &m_properties;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
public override void SetRigidBody(RigidBody body)
|
||||
|
@ -2314,7 +2314,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
(((v1.Z - nEpsilon) < v2.Z) && (v2.Z < (v1.Z + nEpsilon))) &&
|
||||
(((v1.W - nEpsilon) < v2.W) && (v2.W < (v1.W + nEpsilon)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ public class BSActorAvatarMove : BSActor
|
|||
if (m_velocityMotor == null)
|
||||
{
|
||||
// Infinite decay and timescale values so motor only changes current to target values.
|
||||
m_velocityMotor = new BSVMotor("BSCharacter.Velocity",
|
||||
m_velocityMotor = new BSVMotor("BSCharacter.Velocity",
|
||||
0.2f, // time scale
|
||||
BSMotor.Infinite, // decay time scale
|
||||
BSMotor.InfiniteVector, // friction timescale
|
||||
|
|
|
@ -63,7 +63,7 @@ public class BSActorLockAxis : BSActor
|
|||
// BSActor.Refresh()
|
||||
public override void Refresh()
|
||||
{
|
||||
m_physicsScene.DetailLog("{0},BSActorLockAxis,refresh,lockedAxis={1},enabled={2},pActive={3}",
|
||||
m_physicsScene.DetailLog("{0},BSActorLockAxis,refresh,lockedAxis={1},enabled={2},pActive={3}",
|
||||
m_controllingPrim.LocalID, m_controllingPrim.LockedAxis, Enabled, m_controllingPrim.IsPhysicallyActive);
|
||||
// If all the axis are free, we don't need to exist
|
||||
if (m_controllingPrim.LockedAxis == m_controllingPrim.LockedAxisFree)
|
||||
|
|
|
@ -117,7 +117,7 @@ public class BSActorCollection
|
|||
/// Each physical object can have 'actors' who are pushing the object around.
|
||||
/// This can be used for hover, locking axis, making vehicles, etc.
|
||||
/// Each physical object can have multiple actors acting on it.
|
||||
///
|
||||
///
|
||||
/// An actor usually registers itself with physics scene events (pre-step action)
|
||||
/// and modifies the parameters on the host physical object.
|
||||
/// </summary>
|
||||
|
|
|
@ -298,7 +298,7 @@ public abstract class BSAPITemplate
|
|||
{
|
||||
// Returns the name of the underlying Bullet engine
|
||||
public abstract string BulletEngineName { get; }
|
||||
public abstract string BulletEngineVersion { get; protected set;}
|
||||
public abstract string BulletEngineVersion { get; protected set;}
|
||||
|
||||
// Initialization and simulation
|
||||
public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms,
|
||||
|
@ -373,7 +373,7 @@ public abstract void DestroyObject(BulletWorld sim, BulletBody obj);
|
|||
// =====================================================================================
|
||||
public abstract BulletShape CreateGroundPlaneShape(UInt32 id, float height, float collisionMargin);
|
||||
|
||||
public abstract BulletShape CreateTerrainShape(UInt32 id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
|
||||
public abstract BulletShape CreateTerrainShape(UInt32 id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
|
||||
float scaleFactor, float collisionMargin);
|
||||
|
||||
// =====================================================================================
|
||||
|
@ -388,7 +388,7 @@ public abstract BulletConstraint Create6DofConstraintToPoint(BulletWorld world,
|
|||
bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
|
||||
|
||||
public abstract BulletConstraint Create6DofConstraintFixed(BulletWorld world, BulletBody obj1,
|
||||
Vector3 frameInBloc, Quaternion frameInBrot,
|
||||
Vector3 frameInBloc, Quaternion frameInBrot,
|
||||
bool useLinearReferenceFrameB, bool disableCollisionsBetweenLinkedBodies);
|
||||
|
||||
public abstract BulletConstraint Create6DofSpringConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2,
|
||||
|
|
|
@ -371,7 +371,7 @@ public sealed class BSCharacter : BSPhysObject
|
|||
public override float Mass { get { return _mass; } }
|
||||
|
||||
// used when we only want this prim's mass and not the linkset thing
|
||||
public override float RawMass {
|
||||
public override float RawMass {
|
||||
get {return _mass; }
|
||||
}
|
||||
public override void UpdatePhysicalMassProperties(float physMass, bool inWorld)
|
||||
|
@ -586,7 +586,7 @@ public sealed class BSCharacter : BSPhysObject
|
|||
}
|
||||
public override float ForceBuoyancy {
|
||||
get { return _buoyancy; }
|
||||
set {
|
||||
set {
|
||||
PhysScene.AssertInTaintTime("BSCharacter.ForceBuoyancy");
|
||||
|
||||
_buoyancy = value;
|
||||
|
@ -647,7 +647,7 @@ public sealed class BSCharacter : BSPhysObject
|
|||
private OMV.Vector3 ComputeAvatarScale(OMV.Vector3 size)
|
||||
{
|
||||
OMV.Vector3 newScale;
|
||||
|
||||
|
||||
// Bullet's capsule total height is the "passed height + radius * 2";
|
||||
// The base capsule is 1 diameter and 2 height (passed radius=0.5, passed height = 1)
|
||||
// The number we pass in for 'scaling' is the multiplier to get that base
|
||||
|
|
|
@ -45,7 +45,7 @@ public sealed class BSConstraintHinge : BSConstraint
|
|||
m_body1 = obj1;
|
||||
m_body2 = obj2;
|
||||
m_constraint = PhysicsScene.PE.CreateHingeConstraint(world, obj1, obj2,
|
||||
pivotInA, pivotInB, axisInA, axisInB,
|
||||
pivotInA, pivotInB, axisInA, axisInB,
|
||||
useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies);
|
||||
m_enabled = true;
|
||||
}
|
||||
|
|
|
@ -1019,7 +1019,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
Vector3 origVelW = VehicleVelocity; // DEBUG DEBUG
|
||||
VehicleVelocity /= VehicleVelocity.Length();
|
||||
VehicleVelocity *= BSParam.VehicleMaxLinearVelocity;
|
||||
VDetailLog("{0}, MoveLinear,clampMax,origVelW={1},lenSq={2},maxVelSq={3},,newVelW={4}",
|
||||
VDetailLog("{0}, MoveLinear,clampMax,origVelW={1},lenSq={2},maxVelSq={3},,newVelW={4}",
|
||||
ControllingPrim.LocalID, origVelW, newVelocityLengthSq, BSParam.VehicleMaxLinearVelocitySquared, VehicleVelocity);
|
||||
}
|
||||
else if (newVelocityLengthSq < 0.001f)
|
||||
|
@ -1094,7 +1094,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
if (VehiclePosition.Z > m_VhoverTargetHeight)
|
||||
m_VhoverTargetHeight = VehiclePosition.Z;
|
||||
}
|
||||
|
||||
|
||||
if ((m_flags & VehicleFlag.LOCK_HOVER_HEIGHT) != 0)
|
||||
{
|
||||
if (Math.Abs(VehiclePosition.Z - m_VhoverTargetHeight) > 0.2f)
|
||||
|
@ -1188,7 +1188,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
// used with conjunction with banking: the strength of the banking will decay when the
|
||||
// vehicle no longer experiences collisions. The decay timescale is the same as
|
||||
// VEHICLE_BANKING_TIMESCALE. This is to help prevent ground vehicles from steering
|
||||
// when they are in mid jump.
|
||||
// when they are in mid jump.
|
||||
// TODO: this code is wrong. Also, what should it do for boats (height from water)?
|
||||
// This is just using the ground and a general collision check. Should really be using
|
||||
// a downward raycast to find what is below.
|
||||
|
@ -1254,7 +1254,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
|
||||
VehicleAddForce(appliedGravity);
|
||||
|
||||
VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},collid={2},fudge={3},mass={4},appliedForce={3}",
|
||||
VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},collid={2},fudge={3},mass={4},appliedForce={3}",
|
||||
ControllingPrim.LocalID, m_VehicleGravity,
|
||||
ControllingPrim.IsColliding, BSParam.VehicleGroundGravityFudge, m_vehicleMass, appliedGravity);
|
||||
}
|
||||
|
@ -1330,7 +1330,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
// From http://wiki.secondlife.com/wiki/LlSetVehicleFlags :
|
||||
// This flag prevents linear deflection parallel to world z-axis. This is useful
|
||||
// for preventing ground vehicles with large linear deflection, like bumper cars,
|
||||
// from climbing their linear deflection into the sky.
|
||||
// from climbing their linear deflection into the sky.
|
||||
// That is, NO_DEFLECTION_UP says angular motion should not add any pitch or roll movement
|
||||
// TODO: This is here because this is where ODE put it but documentation says it
|
||||
// is a linear effect. Where should this check go?
|
||||
|
@ -1463,7 +1463,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
VehicleRotationalVelocity += (vertContributionV * VehicleOrientation);
|
||||
|
||||
VDetailLog("{0}, MoveAngular,verticalAttraction,,origRotVW={1},vertError={2},unscaledV={3},eff={4},ts={5},vertContribV={6}",
|
||||
Prim.LocalID, origRotVelW, verticalError, unscaledContribVerticalErrorV,
|
||||
Prim.LocalID, origRotVelW, verticalError, unscaledContribVerticalErrorV,
|
||||
m_verticalAttractionEfficiency, m_verticalAttractionTimescale, vertContributionV);
|
||||
*/
|
||||
}
|
||||
|
@ -1530,13 +1530,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
// produce a angular velocity around the yaw-axis, causing the vehicle to turn. The magnitude
|
||||
// of the yaw effect will be proportional to the
|
||||
// VEHICLE_BANKING_EFFICIENCY, the angle of the roll rotation, and sometimes the vehicle's
|
||||
// velocity along its preferred axis of motion.
|
||||
// velocity along its preferred axis of motion.
|
||||
// The VEHICLE_BANKING_EFFICIENCY can vary between -1 and +1. When it is positive then any
|
||||
// positive rotation (by the right-hand rule) about the roll-axis will effect a
|
||||
// (negative) torque around the yaw-axis, making it turn to the right--that is the
|
||||
// vehicle will lean into the turn, which is how real airplanes and motorcycle's work.
|
||||
// Negating the banking coefficient will make it so that the vehicle leans to the
|
||||
// outside of the turn (not very "physical" but might allow interesting vehicles so why not?).
|
||||
// outside of the turn (not very "physical" but might allow interesting vehicles so why not?).
|
||||
// The VEHICLE_BANKING_MIX is a fake (i.e. non-physical) parameter that is useful for making
|
||||
// banking vehicles do what you want rather than what the laws of physics allow.
|
||||
// For example, consider a real motorcycle...it must be moving forward in order for
|
||||
|
@ -1548,11 +1548,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
// totally static (0.0) and totally dynamic (1.0). By "static" we mean that the
|
||||
// banking effect depends only on the vehicle's rotation about its roll-axis compared
|
||||
// to "dynamic" where the banking is also proportional to its velocity along its
|
||||
// roll-axis. Finding the best value of the "mixture" will probably require trial and error.
|
||||
// roll-axis. Finding the best value of the "mixture" will probably require trial and error.
|
||||
// The time it takes for the banking behavior to defeat a preexisting angular velocity about the
|
||||
// world z-axis is determined by the VEHICLE_BANKING_TIMESCALE. So if you want the vehicle to
|
||||
// bank quickly then give it a banking timescale of about a second or less, otherwise you can
|
||||
// make a sluggish vehicle by giving it a timescale of several seconds.
|
||||
// make a sluggish vehicle by giving it a timescale of several seconds.
|
||||
public void ComputeAngularBanking()
|
||||
{
|
||||
if (enableAngularBanking && m_bankingEfficiency != 0 && m_verticalAttractionTimescale < m_verticalAttractionCutoff)
|
||||
|
@ -1581,7 +1581,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
|
||||
//VehicleRotationalVelocity += bankingContributionV * VehicleOrientation;
|
||||
VehicleRotationalVelocity += bankingContributionV;
|
||||
|
||||
|
||||
|
||||
VDetailLog("{0}, MoveAngular,Banking,rollComp={1},speed={2},rollComp={3},yAng={4},mYAng={5},ret={6}",
|
||||
ControllingPrim.LocalID, rollComponents, VehicleForwardSpeed, rollComponents, yawAngle, mixedYawAngle, bankingContributionV);
|
||||
|
|
|
@ -214,7 +214,7 @@ public abstract class BSLinkset
|
|||
// I am the root of a linkset and a new child is being added
|
||||
// Called while LinkActivity is locked.
|
||||
protected abstract void AddChildToLinkset(BSPrimLinkable child);
|
||||
|
||||
|
||||
// I am the root of a linkset and one of my children is being removed.
|
||||
// Safe to call even if the child is not really in my linkset.
|
||||
protected abstract void RemoveChildFromLinkset(BSPrimLinkable child);
|
||||
|
|
|
@ -114,7 +114,7 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
// Schedule a refresh to happen after all the other taint processing.
|
||||
private void ScheduleRebuild(BSPrimLinkable requestor)
|
||||
{
|
||||
DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2},actuallyScheduling={3}",
|
||||
DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2},actuallyScheduling={3}",
|
||||
requestor.LocalID, Rebuilding, HasAnyChildren, (!Rebuilding && HasAnyChildren));
|
||||
// When rebuilding, it is possible to set properties that would normally require a rebuild.
|
||||
// If already rebuilding, don't request another rebuild.
|
||||
|
@ -208,7 +208,7 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
// and that is caused by us updating the object.
|
||||
if ((whichUpdated & ~(UpdatedProperties.Position | UpdatedProperties.Orientation)) == 0)
|
||||
{
|
||||
// Find the physical instance of the child
|
||||
// Find the physical instance of the child
|
||||
if (LinksetRoot.PhysShape.HasPhysicalShape && m_physicsScene.PE.IsCompound(LinksetRoot.PhysShape.physShapeInfo))
|
||||
{
|
||||
// It is possible that the linkset is still under construction and the child is not yet
|
||||
|
|
|
@ -102,7 +102,7 @@ public class BSVMotor : BSMotor
|
|||
return ErrorIsZero(LastError);
|
||||
}
|
||||
public virtual bool ErrorIsZero(Vector3 err)
|
||||
{
|
||||
{
|
||||
return (err == Vector3.Zero || err.ApproxEquals(Vector3.Zero, ErrorZeroThreshold));
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class BSVMotor : BSMotor
|
|||
CurrentValue = TargetValue = Vector3.Zero;
|
||||
ErrorZeroThreshold = 0.001f;
|
||||
}
|
||||
public BSVMotor(string useName, float timeScale, float decayTimeScale, Vector3 frictionTimeScale, float efficiency)
|
||||
public BSVMotor(string useName, float timeScale, float decayTimeScale, Vector3 frictionTimeScale, float efficiency)
|
||||
: this(useName)
|
||||
{
|
||||
TimeScale = timeScale;
|
||||
|
@ -237,7 +237,7 @@ public class BSVMotor : BSMotor
|
|||
MDetailLog("{0},BSVMotor.Test,{1},===================================== BEGIN Test Output", BSScene.DetailLogZero, UseName);
|
||||
MDetailLog("{0},BSVMotor.Test,{1},timeScale={2},targDlyTS={3},frictTS={4},eff={5},curr={6},tgt={7}",
|
||||
BSScene.DetailLogZero, UseName,
|
||||
TimeScale, TargetValueDecayTimeScale, FrictionTimescale, Efficiency,
|
||||
TimeScale, TargetValueDecayTimeScale, FrictionTimescale, Efficiency,
|
||||
CurrentValue, TargetValue);
|
||||
|
||||
LastError = BSMotor.InfiniteVector;
|
||||
|
@ -248,7 +248,7 @@ public class BSVMotor : BSMotor
|
|||
BSScene.DetailLogZero, UseName, CurrentValue, TargetValue, LastError, lastStep);
|
||||
}
|
||||
MDetailLog("{0},BSVMotor.Test,{1},===================================== END Test Output", BSScene.DetailLogZero, UseName);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ public class BSFMotor : BSMotor
|
|||
return ErrorIsZero(LastError);
|
||||
}
|
||||
public virtual bool ErrorIsZero(float err)
|
||||
{
|
||||
{
|
||||
return (err >= -ErrorZeroThreshold && err <= ErrorZeroThreshold);
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ public class BSPIDVMotor : BSVMotor
|
|||
// The factors are vectors for the three dimensions. This is the proportional of each
|
||||
// that is applied. This could be multiplied through the actual factors but it
|
||||
// is sometimes easier to manipulate the factors and their mix separately.
|
||||
// to
|
||||
// to
|
||||
public Vector3 FactorMix;
|
||||
|
||||
// Arbritrary factor range.
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
{
|
||||
public static class BSParam
|
||||
{
|
||||
private static string LogHeader = "[BULLETSIM PARAMETERS]";
|
||||
private static string LogHeader = "[BULLETSIM PARAMETERS]";
|
||||
|
||||
// Tuning notes:
|
||||
// From: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=6575
|
||||
|
@ -51,7 +51,7 @@ public static class BSParam
|
|||
// This is separate/independent from the collision margin. The collision margin increases the object a bit
|
||||
// to improve collision detection performance and accuracy.
|
||||
// ===================
|
||||
// From:
|
||||
// From:
|
||||
|
||||
// Level of Detail values kept as float because that's what the Meshmerizer wants
|
||||
public static float MeshLOD { get; private set; }
|
||||
|
@ -636,7 +636,7 @@ public static class BSParam
|
|||
new ParameterDefn<bool>("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count",
|
||||
false,
|
||||
(s) => { return ShouldDisableContactPoolDynamicAllocation; },
|
||||
(s,v) => { ShouldDisableContactPoolDynamicAllocation = v;
|
||||
(s,v) => { ShouldDisableContactPoolDynamicAllocation = v;
|
||||
s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = NumericBool(v); } ),
|
||||
new ParameterDefn<bool>("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step",
|
||||
false,
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
* Class to wrap all objects.
|
||||
* The rest of BulletSim doesn't need to keep checking for avatars or prims
|
||||
* unless the difference is significant.
|
||||
*
|
||||
*
|
||||
* Variables in the physicsl objects are in three forms:
|
||||
* VariableName: used by the simulator and performs taint operations, etc
|
||||
* RawVariableName: direct reference to the BulletSim storage for the variable value
|
||||
|
@ -52,7 +52,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
* SOP.ApplyImpulse SOP.ApplyAngularImpulse SOP.SetAngularImpulse SOP.SetForce
|
||||
* SOG.ApplyImpulse SOG.ApplyAngularImpulse SOG.SetAngularImpulse
|
||||
* PA.AddForce PA.AddAngularForce PA.Torque = v PA.Force = v
|
||||
* BS.ApplyCentralForce BS.ApplyTorque
|
||||
* BS.ApplyCentralForce BS.ApplyTorque
|
||||
*/
|
||||
|
||||
// Flags used to denote which properties updates when making UpdateProperties calls to linksets, etc.
|
||||
|
@ -353,7 +353,7 @@ public abstract class BSPhysObject : PhysicsActor
|
|||
}
|
||||
public override bool CollidingObj {
|
||||
get { return (CollidingObjectStep == PhysScene.SimulationStep); }
|
||||
set {
|
||||
set {
|
||||
if (value)
|
||||
CollidingObjectStep = PhysScene.SimulationStep;
|
||||
else
|
||||
|
@ -447,7 +447,7 @@ public abstract class BSPhysObject : PhysicsActor
|
|||
|
||||
// The CollisionCollection instance is passed around in the simulator.
|
||||
// Make sure we don't have a handle to that one and that a new one is used for next time.
|
||||
// This fixes an interesting 'gotcha'. If we call CollisionCollection.Clear() here,
|
||||
// This fixes an interesting 'gotcha'. If we call CollisionCollection.Clear() here,
|
||||
// a race condition is created for the other users of this instance.
|
||||
CollisionCollection = new CollisionEventUpdate();
|
||||
}
|
||||
|
|
|
@ -420,7 +420,7 @@ public class BSPrim : BSPhysObject
|
|||
get { return _mass; }
|
||||
}
|
||||
// used when we only want this prim's mass and not the linkset thing
|
||||
public override float RawMass {
|
||||
public override float RawMass {
|
||||
get { return _mass; }
|
||||
}
|
||||
// Set the physical mass to the passed mass.
|
||||
|
|
|
@ -142,7 +142,7 @@ public abstract class BSShape
|
|||
// If the shape was successfully created, nothing more to do
|
||||
if (newShape.HasPhysicalShape)
|
||||
return newShape;
|
||||
|
||||
|
||||
// VerifyMeshCreated is called after trying to create the mesh. If we think the asset had been
|
||||
// fetched but we end up here again, the meshing of the asset must have failed.
|
||||
// Prevent trying to keep fetching the mesh by declaring failure.
|
||||
|
@ -155,7 +155,7 @@ public abstract class BSShape
|
|||
else
|
||||
{
|
||||
// If this mesh has an underlying asset and we have not failed getting it before, fetch the asset
|
||||
if (prim.BaseShape.SculptEntry
|
||||
if (prim.BaseShape.SculptEntry
|
||||
&& prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Failed
|
||||
&& prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Waiting
|
||||
&& prim.BaseShape.SculptTexture != OMV.UUID.Zero
|
||||
|
@ -164,7 +164,7 @@ public abstract class BSShape
|
|||
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,fetchAsset", prim.LocalID);
|
||||
// Multiple requestors will know we're waiting for this asset
|
||||
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Waiting;
|
||||
|
||||
|
||||
BSPhysObject xprim = prim;
|
||||
Util.FireAndForget(delegate
|
||||
{
|
||||
|
@ -245,8 +245,8 @@ public class BSShapeNative : BSShape
|
|||
{
|
||||
}
|
||||
|
||||
public static BSShape GetReference(BSScene physicsScene, BSPhysObject prim,
|
||||
BSPhysicsShapeType shapeType, FixedShapeKey shapeKey)
|
||||
public static BSShape GetReference(BSScene physicsScene, BSPhysObject prim,
|
||||
BSPhysicsShapeType shapeType, FixedShapeKey shapeKey)
|
||||
{
|
||||
// Native shapes are not shared and are always built anew.
|
||||
return new BSShapeNative(CreatePhysicalNativeShape(physicsScene, prim, shapeType, shapeKey));
|
||||
|
@ -379,7 +379,7 @@ public class BSShapeMesh : BSShape
|
|||
{
|
||||
BulletShape newShape = null;
|
||||
|
||||
IMesh meshData = physicsScene.mesher.CreateMesh(prim.PhysObjectName, pbs, size, lod,
|
||||
IMesh meshData = physicsScene.mesher.CreateMesh(prim.PhysObjectName, pbs, size, lod,
|
||||
false, // say it is not physical so a bounding box is not built
|
||||
false // do not cache the mesh and do not use previously built versions
|
||||
);
|
||||
|
@ -671,8 +671,8 @@ public class BSShapeCompound : BSShape
|
|||
public BSShapeCompound(BulletShape pShape) : base(pShape)
|
||||
{
|
||||
}
|
||||
public static BSShape GetReference(BSScene physicsScene, BSPhysObject prim)
|
||||
{
|
||||
public static BSShape GetReference(BSScene physicsScene, BSPhysObject prim)
|
||||
{
|
||||
// Compound shapes are not shared so a new one is created every time.
|
||||
return new BSShapeCompound(CreatePhysicalCompoundShape(physicsScene, prim));
|
||||
}
|
||||
|
@ -750,8 +750,8 @@ public class BSShapeAvatar : BSShape
|
|||
public BSShapeAvatar() : base()
|
||||
{
|
||||
}
|
||||
public static BSShape GetReference(BSPhysObject prim)
|
||||
{
|
||||
public static BSShape GetReference(BSPhysObject prim)
|
||||
{
|
||||
return new BSShapeNull();
|
||||
}
|
||||
public override void Dereference(BSScene physicsScene) { }
|
||||
|
|
|
@ -68,7 +68,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
|
|||
|
||||
// This minCoords and maxCoords passed in give the size of the terrain (min and max Z
|
||||
// are the high and low points of the heightmap).
|
||||
public BSTerrainHeightmap(BSScene physicsScene, Vector3 regionBase, uint id, float[] initialMap,
|
||||
public BSTerrainHeightmap(BSScene physicsScene, Vector3 regionBase, uint id, float[] initialMap,
|
||||
Vector3 minCoords, Vector3 maxCoords)
|
||||
: base(physicsScene, regionBase, id)
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
|
|||
private void BuildHeightmapTerrain()
|
||||
{
|
||||
// Create the terrain shape from the mapInfo
|
||||
m_mapInfo.terrainShape = m_physicsScene.PE.CreateTerrainShape( m_mapInfo.ID,
|
||||
m_mapInfo.terrainShape = m_physicsScene.PE.CreateTerrainShape( m_mapInfo.ID,
|
||||
new Vector3(m_mapInfo.sizeX, m_mapInfo.sizeY, 0), m_mapInfo.minZ, m_mapInfo.maxZ,
|
||||
m_mapInfo.heightMap, 1f, BSParam.TerrainCollisionMargin);
|
||||
|
||||
|
@ -103,7 +103,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
|
|||
centerPos.Y = m_mapInfo.minCoords.Y + (m_mapInfo.sizeY / 2f);
|
||||
centerPos.Z = m_mapInfo.minZ + ((m_mapInfo.maxZ - m_mapInfo.minZ) / 2f);
|
||||
|
||||
m_mapInfo.terrainBody = m_physicsScene.PE.CreateBodyWithDefaultMotionState(m_mapInfo.terrainShape,
|
||||
m_mapInfo.terrainBody = m_physicsScene.PE.CreateBodyWithDefaultMotionState(m_mapInfo.terrainShape,
|
||||
m_mapInfo.ID, centerPos, Quaternion.Identity);
|
||||
|
||||
// Set current terrain attributes
|
||||
|
|
|
@ -135,7 +135,7 @@ public sealed class BSTerrainManager : IDisposable
|
|||
DetailLog("{0},BSTerrainManager.CreateInitialGroundPlaneAndTerrain,region={1}", BSScene.DetailLogZero, m_physicsScene.RegionName);
|
||||
// The ground plane is here to catch things that are trying to drop to negative infinity
|
||||
BulletShape groundPlaneShape = m_physicsScene.PE.CreateGroundPlaneShape(BSScene.GROUNDPLANE_ID, 1f, BSParam.TerrainCollisionMargin);
|
||||
m_groundPlane = m_physicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape,
|
||||
m_groundPlane = m_physicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape,
|
||||
BSScene.GROUNDPLANE_ID, Vector3.Zero, Quaternion.Identity);
|
||||
|
||||
m_physicsScene.PE.AddObjectToWorld(m_physicsScene.World, m_groundPlane);
|
||||
|
@ -318,8 +318,8 @@ public sealed class BSTerrainManager : IDisposable
|
|||
// TODO: redo terrain implementation selection to allow other base types than heightMap.
|
||||
private BSTerrainPhys BuildPhysicalTerrain(Vector3 terrainRegionBase, uint id, float[] heightMap, Vector3 minCoords, Vector3 maxCoords)
|
||||
{
|
||||
m_physicsScene.Logger.DebugFormat("{0} Terrain for {1}/{2} created with {3}",
|
||||
LogHeader, m_physicsScene.RegionName, terrainRegionBase,
|
||||
m_physicsScene.Logger.DebugFormat("{0} Terrain for {1}/{2} created with {3}",
|
||||
LogHeader, m_physicsScene.RegionName, terrainRegionBase,
|
||||
(BSTerrainPhys.TerrainImplementation)BSParam.TerrainImplementation);
|
||||
BSTerrainPhys newTerrainPhys = null;
|
||||
switch ((int)BSParam.TerrainImplementation)
|
||||
|
@ -334,8 +334,8 @@ public sealed class BSTerrainManager : IDisposable
|
|||
break;
|
||||
default:
|
||||
m_physicsScene.Logger.ErrorFormat("{0} Bad terrain implementation specified. Type={1}/{2},Region={3}/{4}",
|
||||
LogHeader,
|
||||
(int)BSParam.TerrainImplementation,
|
||||
LogHeader,
|
||||
(int)BSParam.TerrainImplementation,
|
||||
BSParam.TerrainImplementation,
|
||||
m_physicsScene.RegionName, terrainRegionBase);
|
||||
break;
|
||||
|
|
|
@ -51,7 +51,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
|
|||
BulletShape m_terrainShape;
|
||||
BulletBody m_terrainBody;
|
||||
|
||||
public BSTerrainMesh(BSScene physicsScene, Vector3 regionBase, uint id, Vector3 regionSize)
|
||||
public BSTerrainMesh(BSScene physicsScene, Vector3 regionBase, uint id, Vector3 regionSize)
|
||||
: base(physicsScene, regionBase, id)
|
||||
{
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
|
|||
}
|
||||
|
||||
// Create terrain mesh from a heightmap.
|
||||
public BSTerrainMesh(BSScene physicsScene, Vector3 regionBase, uint id, float[] initialMap,
|
||||
public BSTerrainMesh(BSScene physicsScene, Vector3 regionBase, uint id, float[] initialMap,
|
||||
Vector3 minCoords, Vector3 maxCoords)
|
||||
: base(physicsScene, regionBase, id)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
|
|||
return;
|
||||
}
|
||||
|
||||
m_physicsScene.DetailLog("{0},BSTerrainMesh.create,meshed,id={1},indices={2},indSz={3},vertices={4},vertSz={5}",
|
||||
m_physicsScene.DetailLog("{0},BSTerrainMesh.create,meshed,id={1},indices={2},indSz={3},vertices={4},vertSz={5}",
|
||||
BSScene.DetailLogZero, ID, indicesCount, indices.Length, verticesCount, vertices.Length);
|
||||
|
||||
m_terrainShape = m_physicsScene.PE.CreateMeshShape(m_physicsScene.World, indicesCount, indices, verticesCount, vertices);
|
||||
|
|
|
@ -224,42 +224,42 @@ public static class BulletSimData
|
|||
// As mentioned above, don't use the CollisionFilterGroups definitions directly in the code
|
||||
// but, instead, use references to this dictionary. Finding and debugging
|
||||
// collision flag problems will be made easier.
|
||||
public static Dictionary<CollisionType, CollisionTypeFilterGroup> CollisionTypeMasks
|
||||
public static Dictionary<CollisionType, CollisionTypeFilterGroup> CollisionTypeMasks
|
||||
= new Dictionary<CollisionType, CollisionTypeFilterGroup>()
|
||||
{
|
||||
{ CollisionType.Avatar,
|
||||
new CollisionTypeFilterGroup(CollisionType.Avatar,
|
||||
(uint)CollisionFilterGroups.BCharacterGroup,
|
||||
{ CollisionType.Avatar,
|
||||
new CollisionTypeFilterGroup(CollisionType.Avatar,
|
||||
(uint)CollisionFilterGroups.BCharacterGroup,
|
||||
(uint)CollisionFilterGroups.BAllGroup)
|
||||
},
|
||||
{ CollisionType.Groundplane,
|
||||
new CollisionTypeFilterGroup(CollisionType.Groundplane,
|
||||
(uint)CollisionFilterGroups.BGroundPlaneGroup,
|
||||
{ CollisionType.Groundplane,
|
||||
new CollisionTypeFilterGroup(CollisionType.Groundplane,
|
||||
(uint)CollisionFilterGroups.BGroundPlaneGroup,
|
||||
(uint)CollisionFilterGroups.BAllGroup)
|
||||
},
|
||||
{ CollisionType.Terrain,
|
||||
new CollisionTypeFilterGroup(CollisionType.Terrain,
|
||||
(uint)CollisionFilterGroups.BTerrainGroup,
|
||||
{ CollisionType.Terrain,
|
||||
new CollisionTypeFilterGroup(CollisionType.Terrain,
|
||||
(uint)CollisionFilterGroups.BTerrainGroup,
|
||||
(uint)(CollisionFilterGroups.BAllGroup & ~CollisionFilterGroups.BStaticGroup))
|
||||
},
|
||||
{ CollisionType.Static,
|
||||
new CollisionTypeFilterGroup(CollisionType.Static,
|
||||
(uint)CollisionFilterGroups.BStaticGroup,
|
||||
{ CollisionType.Static,
|
||||
new CollisionTypeFilterGroup(CollisionType.Static,
|
||||
(uint)CollisionFilterGroups.BStaticGroup,
|
||||
(uint)(CollisionFilterGroups.BCharacterGroup | CollisionFilterGroups.BSolidGroup))
|
||||
},
|
||||
{ CollisionType.Dynamic,
|
||||
new CollisionTypeFilterGroup(CollisionType.Dynamic,
|
||||
(uint)CollisionFilterGroups.BSolidGroup,
|
||||
{ CollisionType.Dynamic,
|
||||
new CollisionTypeFilterGroup(CollisionType.Dynamic,
|
||||
(uint)CollisionFilterGroups.BSolidGroup,
|
||||
(uint)(CollisionFilterGroups.BAllGroup))
|
||||
},
|
||||
{ CollisionType.VolumeDetect,
|
||||
new CollisionTypeFilterGroup(CollisionType.VolumeDetect,
|
||||
(uint)CollisionFilterGroups.BSensorTrigger,
|
||||
{ CollisionType.VolumeDetect,
|
||||
new CollisionTypeFilterGroup(CollisionType.VolumeDetect,
|
||||
(uint)CollisionFilterGroups.BSensorTrigger,
|
||||
(uint)(~CollisionFilterGroups.BSensorTrigger))
|
||||
},
|
||||
{ CollisionType.LinksetChild,
|
||||
new CollisionTypeFilterGroup(CollisionType.LinksetChild,
|
||||
(uint)CollisionFilterGroups.BLinksetChildGroup,
|
||||
new CollisionTypeFilterGroup(CollisionType.LinksetChild,
|
||||
(uint)CollisionFilterGroups.BLinksetChildGroup,
|
||||
(uint)(CollisionFilterGroups.BNoneGroup))
|
||||
// (uint)(CollisionFilterGroups.BCharacterGroup | CollisionFilterGroups.BSolidGroup))
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue