diff options
author | Adam Frisby | 2008-05-13 17:05:52 +0000 |
---|---|---|
committer | Adam Frisby | 2008-05-13 17:05:52 +0000 |
commit | 5548dd6b064061cd009beff1932906b3eb58fc0e (patch) | |
tree | c45d1846e33828067957274052d8feff9a906d0f | |
parent | *Complete redo of the permissions module (diff) | |
download | opensim-SC-5548dd6b064061cd009beff1932906b3eb58fc0e.zip opensim-SC-5548dd6b064061cd009beff1932906b3eb58fc0e.tar.gz opensim-SC-5548dd6b064061cd009beff1932906b3eb58fc0e.tar.bz2 opensim-SC-5548dd6b064061cd009beff1932906b3eb58fc0e.tar.xz |
* Some more bulletx physics fixes from Jed (DeepThink)
-rw-r--r-- | OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 67de7f8..102a1e6 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -278,7 +278,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
278 | // nameB = bxpB._name; | 278 | // nameB = bxpB._name; |
279 | // else | 279 | // else |
280 | // nameB = "null"; | 280 | // nameB = "null"; |
281 | bool needsCollision; | 281 | bool needsCollision;// = base.NeedsCollision(bodyA, bodyB); |
282 | int c1 = 3; | 282 | int c1 = 3; |
283 | int c2 = 3; | 283 | int c2 = 3; |
284 | 284 | ||
@@ -288,7 +288,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
288 | //data: May 07,2005 | 288 | //data: May 07,2005 |
289 | //////////////////////////////////////////////////////// | 289 | //////////////////////////////////////////////////////// |
290 | #region BulletXMeshCollisions Fields | 290 | #region BulletXMeshCollisions Fields |
291 | 291 | ||
292 | 292 | ||
293 | if (bxcA != null && bxpB != null) | 293 | if (bxcA != null && bxpB != null) |
294 | c1 = Collision(bxcA, bxpB); | 294 | c1 = Collision(bxcA, bxpB); |
@@ -299,7 +299,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
299 | else if (c2 < 2) | 299 | else if (c2 < 2) |
300 | needsCollision = (c2 > 0) ? true : false; | 300 | needsCollision = (c2 > 0) ? true : false; |
301 | else | 301 | else |
302 | needsCollision = NeedsCollision(bodyA, bodyB); | 302 | needsCollision = base.NeedsCollision(bodyA, bodyB); |
303 | 303 | ||
304 | 304 | ||
305 | #endregion | 305 | #endregion |
@@ -320,7 +320,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
320 | Vector3[] vertexBase; | 320 | Vector3[] vertexBase; |
321 | Vector3 vNormal, vP1, vP2, vP3; | 321 | Vector3 vNormal, vP1, vP2, vP3; |
322 | IMesh mesh = primB.GetMesh(); | 322 | IMesh mesh = primB.GetMesh(); |
323 | 323 | ||
324 | float fdistance; | 324 | float fdistance; |
325 | if (primB == null) | 325 | if (primB == null) |
326 | return 3; | 326 | return 3; |
@@ -359,16 +359,16 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
359 | Vector3.Cross(ref v1, ref v2, out vNormal); | 359 | Vector3.Cross(ref v1, ref v2, out vNormal); |
360 | Vector3.Normalize(ref vNormal, out vNormal); | 360 | Vector3.Normalize(ref vNormal, out vNormal); |
361 | 361 | ||
362 | fdistance = Vector3.Dot(vNormal, vertexBase[ia]) + 5.0f; | 362 | fdistance = Vector3.Dot(vNormal, vertexBase[ia]) + 0.50f; |
363 | if (preCheckCollision(actorA, vNormal, fdistance) == 1) | 363 | if (preCheckCollision(actorA, vNormal, fdistance) == 1) |
364 | { | 364 | { |
365 | if (CheckCollision(actorA, ia, ib, ic, vNormal, vertexBase) == 1) | 365 | if (CheckCollision(actorA, ia, ib, ic, vNormal, vertexBase) == 1) |
366 | { | 366 | { |
367 | //PhysicsVector v = actorA.Position; | 367 | //PhysicsVector v = actorA.Position; |
368 | //Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v); | 368 | //Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v); |
369 | //Vector3 vp = vNormal * (fdistance - Vector3.Dot(vNormal, v3) + 0.0f); | 369 | //Vector3 vp = vNormal * (fdistance - Vector3.Dot(vNormal, v3) + 0.2f); |
370 | //actorA.Position += BulletXMaths.XnaVector3ToPhysicsVector(vp); | 370 | //actorA.Position += BulletXMaths.XnaVector3ToPhysicsVector(vp); |
371 | return 1; | 371 | return 1; |
372 | } | 372 | } |
373 | } | 373 | } |
374 | } | 374 | } |
@@ -406,13 +406,13 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
406 | 406 | ||
407 | if (Vector3.Dot((vertBase[ic] - vertBase[ia]), perPlaneNormal) < 0) | 407 | if (Vector3.Dot((vertBase[ic] - vertBase[ia]), perPlaneNormal) < 0) |
408 | perPlaneNormal = -perPlaneNormal; | 408 | perPlaneNormal = -perPlaneNormal; |
409 | fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ia]) - 5.0f; | 409 | fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ia]) - 0.50f; |
410 | 410 | ||
411 | 411 | ||
412 | 412 | ||
413 | if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) < 0) | 413 | if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) < 0) |
414 | return 0; | 414 | return 0; |
415 | fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ic]) + 5.0f; | 415 | fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ic]) + 0.50f; |
416 | if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) > 0) | 416 | if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) > 0) |
417 | return 0; | 417 | return 0; |
418 | 418 | ||
@@ -424,12 +424,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
424 | 424 | ||
425 | if (Vector3.Dot((vertBase[ia] - vertBase[ib]), perPlaneNormal) < 0) | 425 | if (Vector3.Dot((vertBase[ia] - vertBase[ib]), perPlaneNormal) < 0) |
426 | perPlaneNormal = -perPlaneNormal; | 426 | perPlaneNormal = -perPlaneNormal; |
427 | fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ib]) - 5.0f; | 427 | fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ib]) - 0.50f; |
428 | 428 | ||
429 | 429 | ||
430 | if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) < 0) | 430 | if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) < 0) |
431 | return 0; | 431 | return 0; |
432 | fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ia]) + 5.0f; | 432 | fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ia]) + 0.50f; |
433 | if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) > 0) | 433 | if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) > 0) |
434 | return 0; | 434 | return 0; |
435 | //check CA | 435 | //check CA |
@@ -439,12 +439,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
439 | 439 | ||
440 | if (Vector3.Dot((vertBase[ib] - vertBase[ic]), perPlaneNormal) < 0) | 440 | if (Vector3.Dot((vertBase[ib] - vertBase[ic]), perPlaneNormal) < 0) |
441 | perPlaneNormal = -perPlaneNormal; | 441 | perPlaneNormal = -perPlaneNormal; |
442 | fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ic]) - 5.0f; | 442 | fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ic]) - 0.50f; |
443 | 443 | ||
444 | 444 | ||
445 | if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) < 0) | 445 | if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) < 0) |
446 | return 0; | 446 | return 0; |
447 | fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ib]) + 5.0f; | 447 | fPerPlaneDist = Vector3.Dot(perPlaneNormal, vertBase[ib]) + 0.50f; |
448 | if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) > 0) | 448 | if ((Vector3.Dot(perPlaneNormal, v3) - fPerPlaneDist) > 0) |
449 | return 0; | 449 | return 0; |
450 | 450 | ||
@@ -1592,7 +1592,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1592 | Matrix _startTransform = Matrix.Identity; | 1592 | Matrix _startTransform = Matrix.Identity; |
1593 | Matrix _centerOfMassOffset = Matrix.Identity; | 1593 | Matrix _centerOfMassOffset = Matrix.Identity; |
1594 | //added by jed zhu | 1594 | //added by jed zhu |
1595 | //_mesh = mesh; | 1595 | _mesh = mesh; |
1596 | 1596 | ||
1597 | lock (BulletXScene.BulletXLock) | 1597 | lock (BulletXScene.BulletXLock) |
1598 | { | 1598 | { |