* Some more bulletx physics fixes from Jed (DeepThink)

0.6.0-stable
Adam Frisby 2008-05-13 17:05:52 +00:00
parent 32785921d0
commit 5548dd6b06
1 changed files with 14 additions and 14 deletions

View File

@ -278,7 +278,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
// nameB = bxpB._name; // nameB = bxpB._name;
// else // else
// nameB = "null"; // nameB = "null";
bool needsCollision; bool needsCollision;// = base.NeedsCollision(bodyA, bodyB);
int c1 = 3; int c1 = 3;
int c2 = 3; int c2 = 3;
@ -299,7 +299,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
else if (c2 < 2) else if (c2 < 2)
needsCollision = (c2 > 0) ? true : false; needsCollision = (c2 > 0) ? true : false;
else else
needsCollision = NeedsCollision(bodyA, bodyB); needsCollision = base.NeedsCollision(bodyA, bodyB);
#endregion #endregion
@ -359,14 +359,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
Vector3.Cross(ref v1, ref v2, out vNormal); Vector3.Cross(ref v1, ref v2, out vNormal);
Vector3.Normalize(ref vNormal, out vNormal); Vector3.Normalize(ref vNormal, out vNormal);
fdistance = Vector3.Dot(vNormal, vertexBase[ia]) + 5.0f; fdistance = Vector3.Dot(vNormal, vertexBase[ia]) + 0.50f;
if (preCheckCollision(actorA, vNormal, fdistance) == 1) if (preCheckCollision(actorA, vNormal, fdistance) == 1)
{ {
if (CheckCollision(actorA, ia, ib, ic, vNormal, vertexBase) == 1) if (CheckCollision(actorA, ia, ib, ic, vNormal, vertexBase) == 1)
{ {
//PhysicsVector v = actorA.Position; //PhysicsVector v = actorA.Position;
//Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v); //Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v);
//Vector3 vp = vNormal * (fdistance - Vector3.Dot(vNormal, v3) + 0.0f); //Vector3 vp = vNormal * (fdistance - Vector3.Dot(vNormal, v3) + 0.2f);
//actorA.Position += BulletXMaths.XnaVector3ToPhysicsVector(vp); //actorA.Position += BulletXMaths.XnaVector3ToPhysicsVector(vp);
return 1; return 1;
} }
@ -406,13 +406,13 @@ namespace OpenSim.Region.Physics.BulletXPlugin
if (Vector3.Dot((vertBase[ic] - vertBase[ia]), perPlaneNormal) < 0) if (Vector3.Dot((vertBase[ic] - vertBase[ia]), perPlaneNormal) < 0)
perPlaneNormal = -perPlaneNormal; perPlaneNormal = -perPlaneNormal;
fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ia]) - 5.0f; fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ia]) - 0.50f;
if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) < 0) if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) < 0)
return 0; return 0;
fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ic]) + 5.0f; fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ic]) + 0.50f;
if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) > 0) if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) > 0)
return 0; return 0;
@ -424,12 +424,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
if (Vector3.Dot((vertBase[ia] - vertBase[ib]), perPlaneNormal) < 0) if (Vector3.Dot((vertBase[ia] - vertBase[ib]), perPlaneNormal) < 0)
perPlaneNormal = -perPlaneNormal; perPlaneNormal = -perPlaneNormal;
fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ib]) - 5.0f; fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ib]) - 0.50f;
if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) < 0) if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) < 0)
return 0; return 0;
fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ia]) + 5.0f; fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ia]) + 0.50f;
if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) > 0) if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) > 0)
return 0; return 0;
//check CA //check CA
@ -439,12 +439,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
if (Vector3.Dot((vertBase[ib] - vertBase[ic]), perPlaneNormal) < 0) if (Vector3.Dot((vertBase[ib] - vertBase[ic]), perPlaneNormal) < 0)
perPlaneNormal = -perPlaneNormal; perPlaneNormal = -perPlaneNormal;
fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ic]) - 5.0f; fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ic]) - 0.50f;
if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) < 0) if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) < 0)
return 0; return 0;
fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ib]) + 5.0f; fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ib]) + 0.50f;
if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) > 0) if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) > 0)
return 0; return 0;
@ -1592,7 +1592,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
Matrix _startTransform = Matrix.Identity; Matrix _startTransform = Matrix.Identity;
Matrix _centerOfMassOffset = Matrix.Identity; Matrix _centerOfMassOffset = Matrix.Identity;
//added by jed zhu //added by jed zhu
//_mesh = mesh; _mesh = mesh;
lock (BulletXScene.BulletXLock) lock (BulletXScene.BulletXLock)
{ {