diff options
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs | 102 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs | 227 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs | 27 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs | 16 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs | 13 | ||||
-rwxr-xr-x | bin/lib32/BulletSim.dll | bin | 546816 -> 570368 bytes | |||
-rwxr-xr-x | bin/lib32/libBulletSim.so | bin | 1700826 -> 1751260 bytes | |||
-rwxr-xr-x | bin/lib64/BulletSim.dll | bin | 694784 -> 720896 bytes | |||
-rwxr-xr-x | bin/lib64/libBulletSim.so | bin | 1843498 -> 1908442 bytes |
9 files changed, 338 insertions, 47 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs index ae54499..3a27d2c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs | |||
@@ -438,6 +438,28 @@ public override BulletConstraint Create6DofConstraintToPoint(BulletWorld world, | |||
438 | joinPoint, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | 438 | joinPoint, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); |
439 | } | 439 | } |
440 | 440 | ||
441 | public override BulletConstraint Create6DofConstraintFixed(BulletWorld world, BulletBody obj1, | ||
442 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
443 | bool useLinearReferenceFrameB, bool disableCollisionsBetweenLinkedBodies) | ||
444 | { | ||
445 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
446 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
447 | return new BulletConstraintUnman(BSAPICPP.Create6DofConstraintFixed2(worldu.ptr, bodyu1.ptr, | ||
448 | frameInBloc, frameInBrot, useLinearReferenceFrameB, disableCollisionsBetweenLinkedBodies)); | ||
449 | } | ||
450 | |||
451 | public override BulletConstraint Create6DofSpringConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
452 | Vector3 frame1loc, Quaternion frame1rot, | ||
453 | Vector3 frame2loc, Quaternion frame2rot, | ||
454 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | ||
455 | { | ||
456 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
457 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
458 | BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman; | ||
459 | return new BulletConstraintUnman(BSAPICPP.Create6DofSpringConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, frame1loc, frame1rot, | ||
460 | frame2loc, frame2rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | ||
461 | } | ||
462 | |||
441 | public override BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | 463 | public override BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, |
442 | Vector3 pivotinA, Vector3 pivotinB, | 464 | Vector3 pivotinA, Vector3 pivotinB, |
443 | Vector3 axisInA, Vector3 axisInB, | 465 | Vector3 axisInA, Vector3 axisInB, |
@@ -450,6 +472,52 @@ public override BulletConstraint CreateHingeConstraint(BulletWorld world, Bullet | |||
450 | pivotinA, pivotinB, axisInA, axisInB, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | 472 | pivotinA, pivotinB, axisInA, axisInB, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); |
451 | } | 473 | } |
452 | 474 | ||
475 | public override BulletConstraint CreateSliderConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
476 | Vector3 frame1loc, Quaternion frame1rot, | ||
477 | Vector3 frame2loc, Quaternion frame2rot, | ||
478 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | ||
479 | { | ||
480 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
481 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
482 | BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman; | ||
483 | return new BulletConstraintUnman(BSAPICPP.CreateSliderConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, frame1loc, frame1rot, | ||
484 | frame2loc, frame2rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | ||
485 | } | ||
486 | |||
487 | public override BulletConstraint CreateConeTwistConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
488 | Vector3 frame1loc, Quaternion frame1rot, | ||
489 | Vector3 frame2loc, Quaternion frame2rot, | ||
490 | bool disableCollisionsBetweenLinkedBodies) | ||
491 | { | ||
492 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
493 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
494 | BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman; | ||
495 | return new BulletConstraintUnman(BSAPICPP.CreateConeTwistConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, frame1loc, frame1rot, | ||
496 | frame2loc, frame2rot, disableCollisionsBetweenLinkedBodies)); | ||
497 | } | ||
498 | |||
499 | public override BulletConstraint CreateGearConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
500 | Vector3 axisInA, Vector3 axisInB, | ||
501 | float ratio, bool disableCollisionsBetweenLinkedBodies) | ||
502 | { | ||
503 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
504 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
505 | BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman; | ||
506 | return new BulletConstraintUnman(BSAPICPP.CreateGearConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, axisInA, axisInB, | ||
507 | ratio, disableCollisionsBetweenLinkedBodies)); | ||
508 | } | ||
509 | |||
510 | public override BulletConstraint CreatePoint2PointConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
511 | Vector3 pivotInA, Vector3 pivotInB, | ||
512 | bool disableCollisionsBetweenLinkedBodies) | ||
513 | { | ||
514 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
515 | BulletBodyUnman bodyu1 = obj1 as BulletBodyUnman; | ||
516 | BulletBodyUnman bodyu2 = obj2 as BulletBodyUnman; | ||
517 | return new BulletConstraintUnman(BSAPICPP.CreatePoint2PointConstraint2(worldu.ptr, bodyu1.ptr, bodyu2.ptr, pivotInA, pivotInB, | ||
518 | disableCollisionsBetweenLinkedBodies)); | ||
519 | } | ||
520 | |||
453 | public override void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse) | 521 | public override void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse) |
454 | { | 522 | { |
455 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | 523 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; |
@@ -1426,12 +1494,46 @@ public static extern IntPtr Create6DofConstraintToPoint2(IntPtr world, IntPtr ob | |||
1426 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | 1494 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); |
1427 | 1495 | ||
1428 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1496 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
1497 | public static extern IntPtr Create6DofConstraintFixed2(IntPtr world, IntPtr obj1, | ||
1498 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
1499 | bool useLinearReferenceFrameB, bool disableCollisionsBetweenLinkedBodies); | ||
1500 | |||
1501 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1502 | public static extern IntPtr Create6DofSpringConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1503 | Vector3 frame1loc, Quaternion frame1rot, | ||
1504 | Vector3 frame2loc, Quaternion frame2rot, | ||
1505 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
1506 | |||
1507 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1429 | public static extern IntPtr CreateHingeConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | 1508 | public static extern IntPtr CreateHingeConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, |
1430 | Vector3 pivotinA, Vector3 pivotinB, | 1509 | Vector3 pivotinA, Vector3 pivotinB, |
1431 | Vector3 axisInA, Vector3 axisInB, | 1510 | Vector3 axisInA, Vector3 axisInB, |
1432 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | 1511 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); |
1433 | 1512 | ||
1434 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1513 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
1514 | public static extern IntPtr CreateSliderConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1515 | Vector3 frameInAloc, Quaternion frameInArot, | ||
1516 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
1517 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
1518 | |||
1519 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1520 | public static extern IntPtr CreateConeTwistConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1521 | Vector3 frameInAloc, Quaternion frameInArot, | ||
1522 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
1523 | bool disableCollisionsBetweenLinkedBodies); | ||
1524 | |||
1525 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1526 | public static extern IntPtr CreateGearConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1527 | Vector3 axisInA, Vector3 axisInB, | ||
1528 | float ratio, bool disableCollisionsBetweenLinkedBodies); | ||
1529 | |||
1530 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1531 | public static extern IntPtr CreatePoint2PointConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, | ||
1532 | Vector3 pivotInA, Vector3 pivotInB, | ||
1533 | bool disableCollisionsBetweenLinkedBodies); | ||
1534 | |||
1535 | |||
1536 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1435 | public static extern void SetConstraintEnable2(IntPtr constrain, float numericTrueFalse); | 1537 | public static extern void SetConstraintEnable2(IntPtr constrain, float numericTrueFalse); |
1436 | 1538 | ||
1437 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1539 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs index 15fa52b..6fc10e9 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs | |||
@@ -559,8 +559,9 @@ private sealed class BulletConstraintXNA : BulletConstraint | |||
559 | } | 559 | } |
560 | 560 | ||
561 | 561 | ||
562 | //BulletSimAPI.Create6DofConstraint(m_world.ptr, m_body1.ptr, m_body2.ptr,frame1, frame1rot,frame2, frame2rot,useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | 562 | public override BulletConstraint Create6DofConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2, |
563 | public override BulletConstraint Create6DofConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2, Vector3 pframe1, Quaternion pframe1rot, Vector3 pframe2, Quaternion pframe2rot, bool puseLinearReferenceFrameA, bool pdisableCollisionsBetweenLinkedBodies) | 563 | Vector3 pframe1, Quaternion pframe1rot, Vector3 pframe2, Quaternion pframe2rot, |
564 | bool puseLinearReferenceFrameA, bool pdisableCollisionsBetweenLinkedBodies) | ||
564 | 565 | ||
565 | { | 566 | { |
566 | DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; | 567 | DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; |
@@ -584,7 +585,24 @@ private sealed class BulletConstraintXNA : BulletConstraint | |||
584 | return new BulletConstraintXNA(consttr); | 585 | return new BulletConstraintXNA(consttr); |
585 | } | 586 | } |
586 | 587 | ||
587 | 588 | public override BulletConstraint Create6DofConstraintFixed(BulletWorld pWorld, BulletBody pBody1, | |
589 | Vector3 pframe1, Quaternion pframe1rot, | ||
590 | bool pUseLinearReferenceFrameB, bool pdisableCollisionsBetweenLinkedBodies) | ||
591 | { | ||
592 | DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; | ||
593 | RigidBody body1 = (pBody1 as BulletBodyXNA).rigidBody; | ||
594 | IndexedVector3 frame1v = new IndexedVector3(pframe1.X, pframe1.Y, pframe1.Z); | ||
595 | IndexedQuaternion frame1rot = new IndexedQuaternion(pframe1rot.X, pframe1rot.Y, pframe1rot.Z, pframe1rot.W); | ||
596 | IndexedMatrix frame1 = IndexedMatrix.CreateFromQuaternion(frame1rot); | ||
597 | frame1._origin = frame1v; | ||
598 | |||
599 | Generic6DofConstraint consttr = new Generic6DofConstraint(body1, ref frame1, pUseLinearReferenceFrameB); | ||
600 | consttr.CalculateTransforms(); | ||
601 | world.AddConstraint(consttr,pdisableCollisionsBetweenLinkedBodies); | ||
602 | |||
603 | return new BulletConstraintXNA(consttr); | ||
604 | } | ||
605 | |||
588 | /// <summary> | 606 | /// <summary> |
589 | /// | 607 | /// |
590 | /// </summary> | 608 | /// </summary> |
@@ -1443,129 +1461,130 @@ private sealed class BulletConstraintXNA : BulletConstraint | |||
1443 | 1461 | ||
1444 | public BSPhysicsShapeType BSShapeTypeFromBroadPhaseNativeType(BroadphaseNativeTypes pin) | 1462 | public BSPhysicsShapeType BSShapeTypeFromBroadPhaseNativeType(BroadphaseNativeTypes pin) |
1445 | { | 1463 | { |
1464 | BSPhysicsShapeType ret = BSPhysicsShapeType.SHAPE_UNKNOWN; | ||
1446 | switch (pin) | 1465 | switch (pin) |
1447 | { | 1466 | { |
1448 | case BroadphaseNativeTypes.BOX_SHAPE_PROXYTYPE: | 1467 | case BroadphaseNativeTypes.BOX_SHAPE_PROXYTYPE: |
1449 | return BSPhysicsShapeType.SHAPE_BOX; | 1468 | ret = BSPhysicsShapeType.SHAPE_BOX; |
1450 | break; | 1469 | break; |
1451 | case BroadphaseNativeTypes.TRIANGLE_SHAPE_PROXYTYPE: | 1470 | case BroadphaseNativeTypes.TRIANGLE_SHAPE_PROXYTYPE: |
1452 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1471 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1453 | break; | 1472 | break; |
1454 | 1473 | ||
1455 | case BroadphaseNativeTypes.TETRAHEDRAL_SHAPE_PROXYTYPE: | 1474 | case BroadphaseNativeTypes.TETRAHEDRAL_SHAPE_PROXYTYPE: |
1456 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1475 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1457 | break; | 1476 | break; |
1458 | case BroadphaseNativeTypes.CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE: | 1477 | case BroadphaseNativeTypes.CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE: |
1459 | return BSPhysicsShapeType.SHAPE_MESH; | 1478 | ret = BSPhysicsShapeType.SHAPE_MESH; |
1460 | break; | 1479 | break; |
1461 | case BroadphaseNativeTypes.CONVEX_HULL_SHAPE_PROXYTYPE: | 1480 | case BroadphaseNativeTypes.CONVEX_HULL_SHAPE_PROXYTYPE: |
1462 | return BSPhysicsShapeType.SHAPE_HULL; | 1481 | ret = BSPhysicsShapeType.SHAPE_HULL; |
1463 | break; | 1482 | break; |
1464 | case BroadphaseNativeTypes.CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE: | 1483 | case BroadphaseNativeTypes.CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE: |
1465 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1484 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1466 | break; | 1485 | break; |
1467 | case BroadphaseNativeTypes.CUSTOM_POLYHEDRAL_SHAPE_TYPE: | 1486 | case BroadphaseNativeTypes.CUSTOM_POLYHEDRAL_SHAPE_TYPE: |
1468 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1487 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1469 | break; | 1488 | break; |
1470 | //implicit convex shapes | 1489 | //implicit convex shapes |
1471 | case BroadphaseNativeTypes.IMPLICIT_CONVEX_SHAPES_START_HERE: | 1490 | case BroadphaseNativeTypes.IMPLICIT_CONVEX_SHAPES_START_HERE: |
1472 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1491 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1473 | break; | 1492 | break; |
1474 | case BroadphaseNativeTypes.SPHERE_SHAPE_PROXYTYPE: | 1493 | case BroadphaseNativeTypes.SPHERE_SHAPE_PROXYTYPE: |
1475 | return BSPhysicsShapeType.SHAPE_SPHERE; | 1494 | ret = BSPhysicsShapeType.SHAPE_SPHERE; |
1476 | break; | 1495 | break; |
1477 | case BroadphaseNativeTypes.MULTI_SPHERE_SHAPE_PROXYTYPE: | 1496 | case BroadphaseNativeTypes.MULTI_SPHERE_SHAPE_PROXYTYPE: |
1478 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1497 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1479 | break; | 1498 | break; |
1480 | case BroadphaseNativeTypes.CAPSULE_SHAPE_PROXYTYPE: | 1499 | case BroadphaseNativeTypes.CAPSULE_SHAPE_PROXYTYPE: |
1481 | return BSPhysicsShapeType.SHAPE_CAPSULE; | 1500 | ret = BSPhysicsShapeType.SHAPE_CAPSULE; |
1482 | break; | 1501 | break; |
1483 | case BroadphaseNativeTypes.CONE_SHAPE_PROXYTYPE: | 1502 | case BroadphaseNativeTypes.CONE_SHAPE_PROXYTYPE: |
1484 | return BSPhysicsShapeType.SHAPE_CONE; | 1503 | ret = BSPhysicsShapeType.SHAPE_CONE; |
1485 | break; | 1504 | break; |
1486 | case BroadphaseNativeTypes.CONVEX_SHAPE_PROXYTYPE: | 1505 | case BroadphaseNativeTypes.CONVEX_SHAPE_PROXYTYPE: |
1487 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1506 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1488 | break; | 1507 | break; |
1489 | case BroadphaseNativeTypes.CYLINDER_SHAPE_PROXYTYPE: | 1508 | case BroadphaseNativeTypes.CYLINDER_SHAPE_PROXYTYPE: |
1490 | return BSPhysicsShapeType.SHAPE_CYLINDER; | 1509 | ret = BSPhysicsShapeType.SHAPE_CYLINDER; |
1491 | break; | 1510 | break; |
1492 | case BroadphaseNativeTypes.UNIFORM_SCALING_SHAPE_PROXYTYPE: | 1511 | case BroadphaseNativeTypes.UNIFORM_SCALING_SHAPE_PROXYTYPE: |
1493 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1512 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1494 | break; | 1513 | break; |
1495 | case BroadphaseNativeTypes.MINKOWSKI_SUM_SHAPE_PROXYTYPE: | 1514 | case BroadphaseNativeTypes.MINKOWSKI_SUM_SHAPE_PROXYTYPE: |
1496 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1515 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1497 | break; | 1516 | break; |
1498 | case BroadphaseNativeTypes.MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE: | 1517 | case BroadphaseNativeTypes.MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE: |
1499 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1518 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1500 | break; | 1519 | break; |
1501 | case BroadphaseNativeTypes.BOX_2D_SHAPE_PROXYTYPE: | 1520 | case BroadphaseNativeTypes.BOX_2D_SHAPE_PROXYTYPE: |
1502 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1521 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1503 | break; | 1522 | break; |
1504 | case BroadphaseNativeTypes.CONVEX_2D_SHAPE_PROXYTYPE: | 1523 | case BroadphaseNativeTypes.CONVEX_2D_SHAPE_PROXYTYPE: |
1505 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1524 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1506 | break; | 1525 | break; |
1507 | case BroadphaseNativeTypes.CUSTOM_CONVEX_SHAPE_TYPE: | 1526 | case BroadphaseNativeTypes.CUSTOM_CONVEX_SHAPE_TYPE: |
1508 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1527 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1509 | break; | 1528 | break; |
1510 | //concave shape | 1529 | //concave shape |
1511 | case BroadphaseNativeTypes.CONCAVE_SHAPES_START_HERE: | 1530 | case BroadphaseNativeTypes.CONCAVE_SHAPES_START_HERE: |
1512 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1531 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1513 | break; | 1532 | break; |
1514 | //keep all the convex shapetype below here, for the check IsConvexShape in broadphase proxy! | 1533 | //keep all the convex shapetype below here, for the check IsConvexShape in broadphase proxy! |
1515 | case BroadphaseNativeTypes.TRIANGLE_MESH_SHAPE_PROXYTYPE: | 1534 | case BroadphaseNativeTypes.TRIANGLE_MESH_SHAPE_PROXYTYPE: |
1516 | return BSPhysicsShapeType.SHAPE_MESH; | 1535 | ret = BSPhysicsShapeType.SHAPE_MESH; |
1517 | break; | 1536 | break; |
1518 | case BroadphaseNativeTypes.SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE: | 1537 | case BroadphaseNativeTypes.SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE: |
1519 | return BSPhysicsShapeType.SHAPE_MESH; | 1538 | ret = BSPhysicsShapeType.SHAPE_MESH; |
1520 | break; | 1539 | break; |
1521 | ///used for demo integration FAST/Swift collision library and Bullet | 1540 | ///used for demo integration FAST/Swift collision library and Bullet |
1522 | case BroadphaseNativeTypes.FAST_CONCAVE_MESH_PROXYTYPE: | 1541 | case BroadphaseNativeTypes.FAST_CONCAVE_MESH_PROXYTYPE: |
1523 | return BSPhysicsShapeType.SHAPE_MESH; | 1542 | ret = BSPhysicsShapeType.SHAPE_MESH; |
1524 | break; | 1543 | break; |
1525 | //terrain | 1544 | //terrain |
1526 | case BroadphaseNativeTypes.TERRAIN_SHAPE_PROXYTYPE: | 1545 | case BroadphaseNativeTypes.TERRAIN_SHAPE_PROXYTYPE: |
1527 | return BSPhysicsShapeType.SHAPE_HEIGHTMAP; | 1546 | ret = BSPhysicsShapeType.SHAPE_HEIGHTMAP; |
1528 | break; | 1547 | break; |
1529 | ///Used for GIMPACT Trimesh integration | 1548 | ///Used for GIMPACT Trimesh integration |
1530 | case BroadphaseNativeTypes.GIMPACT_SHAPE_PROXYTYPE: | 1549 | case BroadphaseNativeTypes.GIMPACT_SHAPE_PROXYTYPE: |
1531 | return BSPhysicsShapeType.SHAPE_MESH; | 1550 | ret = BSPhysicsShapeType.SHAPE_MESH; |
1532 | break; | 1551 | break; |
1533 | ///Multimaterial mesh | 1552 | ///Multimaterial mesh |
1534 | case BroadphaseNativeTypes.MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE: | 1553 | case BroadphaseNativeTypes.MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE: |
1535 | return BSPhysicsShapeType.SHAPE_MESH; | 1554 | ret = BSPhysicsShapeType.SHAPE_MESH; |
1536 | break; | 1555 | break; |
1537 | 1556 | ||
1538 | case BroadphaseNativeTypes.EMPTY_SHAPE_PROXYTYPE: | 1557 | case BroadphaseNativeTypes.EMPTY_SHAPE_PROXYTYPE: |
1539 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1558 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1540 | break; | 1559 | break; |
1541 | case BroadphaseNativeTypes.STATIC_PLANE_PROXYTYPE: | 1560 | case BroadphaseNativeTypes.STATIC_PLANE_PROXYTYPE: |
1542 | return BSPhysicsShapeType.SHAPE_GROUNDPLANE; | 1561 | ret = BSPhysicsShapeType.SHAPE_GROUNDPLANE; |
1543 | break; | 1562 | break; |
1544 | case BroadphaseNativeTypes.CUSTOM_CONCAVE_SHAPE_TYPE: | 1563 | case BroadphaseNativeTypes.CUSTOM_CONCAVE_SHAPE_TYPE: |
1545 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1564 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1546 | break; | 1565 | break; |
1547 | case BroadphaseNativeTypes.CONCAVE_SHAPES_END_HERE: | 1566 | case BroadphaseNativeTypes.CONCAVE_SHAPES_END_HERE: |
1548 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1567 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1549 | break; | 1568 | break; |
1550 | 1569 | ||
1551 | case BroadphaseNativeTypes.COMPOUND_SHAPE_PROXYTYPE: | 1570 | case BroadphaseNativeTypes.COMPOUND_SHAPE_PROXYTYPE: |
1552 | return BSPhysicsShapeType.SHAPE_COMPOUND; | 1571 | ret = BSPhysicsShapeType.SHAPE_COMPOUND; |
1553 | break; | 1572 | break; |
1554 | 1573 | ||
1555 | case BroadphaseNativeTypes.SOFTBODY_SHAPE_PROXYTYPE: | 1574 | case BroadphaseNativeTypes.SOFTBODY_SHAPE_PROXYTYPE: |
1556 | return BSPhysicsShapeType.SHAPE_MESH; | 1575 | ret = BSPhysicsShapeType.SHAPE_MESH; |
1557 | break; | 1576 | break; |
1558 | case BroadphaseNativeTypes.HFFLUID_SHAPE_PROXYTYPE: | 1577 | case BroadphaseNativeTypes.HFFLUID_SHAPE_PROXYTYPE: |
1559 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1578 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1560 | break; | 1579 | break; |
1561 | case BroadphaseNativeTypes.HFFLUID_BUOYANT_CONVEX_SHAPE_PROXYTYPE: | 1580 | case BroadphaseNativeTypes.HFFLUID_BUOYANT_CONVEX_SHAPE_PROXYTYPE: |
1562 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1581 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1563 | break; | 1582 | break; |
1564 | case BroadphaseNativeTypes.INVALID_SHAPE_PROXYTYPE: | 1583 | case BroadphaseNativeTypes.INVALID_SHAPE_PROXYTYPE: |
1565 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1584 | ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
1566 | break; | 1585 | break; |
1567 | } | 1586 | } |
1568 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 1587 | return ret; |
1569 | } | 1588 | } |
1570 | 1589 | ||
1571 | public override void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape) { /* TODO */ } | 1590 | public override void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape) { /* TODO */ } |
@@ -1579,7 +1598,39 @@ private sealed class BulletConstraintXNA : BulletConstraint | |||
1579 | return new BulletShapeXNA(m_planeshape, BSPhysicsShapeType.SHAPE_GROUNDPLANE); | 1598 | return new BulletShapeXNA(m_planeshape, BSPhysicsShapeType.SHAPE_GROUNDPLANE); |
1580 | } | 1599 | } |
1581 | 1600 | ||
1582 | public override BulletConstraint CreateHingeConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2, Vector3 ppivotInA, Vector3 ppivotInB, Vector3 paxisInA, Vector3 paxisInB, bool puseLinearReferenceFrameA, bool pdisableCollisionsBetweenLinkedBodies) | 1601 | public override BulletConstraint Create6DofSpringConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2, |
1602 | Vector3 pframe1, Quaternion pframe1rot, Vector3 pframe2, Quaternion pframe2rot, | ||
1603 | bool puseLinearReferenceFrameA, bool pdisableCollisionsBetweenLinkedBodies) | ||
1604 | |||
1605 | { | ||
1606 | Generic6DofSpringConstraint constrain = null; | ||
1607 | DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; | ||
1608 | RigidBody body1 = (pBody1 as BulletBodyXNA).rigidBody; | ||
1609 | RigidBody body2 = (pBody2 as BulletBodyXNA).rigidBody; | ||
1610 | if (body1 != null && body2 != null) | ||
1611 | { | ||
1612 | IndexedVector3 frame1v = new IndexedVector3(pframe1.X, pframe1.Y, pframe1.Z); | ||
1613 | IndexedQuaternion frame1rot = new IndexedQuaternion(pframe1rot.X, pframe1rot.Y, pframe1rot.Z, pframe1rot.W); | ||
1614 | IndexedMatrix frame1 = IndexedMatrix.CreateFromQuaternion(frame1rot); | ||
1615 | frame1._origin = frame1v; | ||
1616 | |||
1617 | IndexedVector3 frame2v = new IndexedVector3(pframe2.X, pframe2.Y, pframe2.Z); | ||
1618 | IndexedQuaternion frame2rot = new IndexedQuaternion(pframe2rot.X, pframe2rot.Y, pframe2rot.Z, pframe2rot.W); | ||
1619 | IndexedMatrix frame2 = IndexedMatrix.CreateFromQuaternion(frame2rot); | ||
1620 | frame2._origin = frame1v; | ||
1621 | |||
1622 | constrain = new Generic6DofSpringConstraint(body1, body2, ref frame1, ref frame2, puseLinearReferenceFrameA); | ||
1623 | world.AddConstraint(constrain, pdisableCollisionsBetweenLinkedBodies); | ||
1624 | |||
1625 | constrain.CalculateTransforms(); | ||
1626 | } | ||
1627 | |||
1628 | return new BulletConstraintXNA(constrain); | ||
1629 | } | ||
1630 | |||
1631 | public override BulletConstraint CreateHingeConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2, | ||
1632 | Vector3 ppivotInA, Vector3 ppivotInB, Vector3 paxisInA, Vector3 paxisInB, | ||
1633 | bool puseLinearReferenceFrameA, bool pdisableCollisionsBetweenLinkedBodies) | ||
1583 | { | 1634 | { |
1584 | HingeConstraint constrain = null; | 1635 | HingeConstraint constrain = null; |
1585 | DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; | 1636 | DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; |
@@ -1591,6 +1642,100 @@ private sealed class BulletConstraintXNA : BulletConstraint | |||
1591 | IndexedVector3 pivotInB = new IndexedVector3(ppivotInB.X, ppivotInB.Y, ppivotInB.Z); | 1642 | IndexedVector3 pivotInB = new IndexedVector3(ppivotInB.X, ppivotInB.Y, ppivotInB.Z); |
1592 | IndexedVector3 axisInA = new IndexedVector3(paxisInA.X, paxisInA.Y, paxisInA.Z); | 1643 | IndexedVector3 axisInA = new IndexedVector3(paxisInA.X, paxisInA.Y, paxisInA.Z); |
1593 | IndexedVector3 axisInB = new IndexedVector3(paxisInB.X, paxisInB.Y, paxisInB.Z); | 1644 | IndexedVector3 axisInB = new IndexedVector3(paxisInB.X, paxisInB.Y, paxisInB.Z); |
1645 | constrain = new HingeConstraint(rb1, rb2, ref pivotInA, ref pivotInB, ref axisInA, ref axisInB, puseLinearReferenceFrameA); | ||
1646 | world.AddConstraint(constrain, pdisableCollisionsBetweenLinkedBodies); | ||
1647 | } | ||
1648 | return new BulletConstraintXNA(constrain); | ||
1649 | } | ||
1650 | |||
1651 | public override BulletConstraint CreateSliderConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2, | ||
1652 | Vector3 pframe1, Quaternion pframe1rot, | ||
1653 | Vector3 pframe2, Quaternion pframe2rot, | ||
1654 | bool puseLinearReferenceFrameA, bool pdisableCollisionsBetweenLinkedBodies) | ||
1655 | { | ||
1656 | SliderConstraint constrain = null; | ||
1657 | DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; | ||
1658 | RigidBody rb1 = (pBody1 as BulletBodyXNA).rigidBody; | ||
1659 | RigidBody rb2 = (pBody2 as BulletBodyXNA).rigidBody; | ||
1660 | if (rb1 != null && rb2 != null) | ||
1661 | { | ||
1662 | IndexedVector3 frame1v = new IndexedVector3(pframe1.X, pframe1.Y, pframe1.Z); | ||
1663 | IndexedQuaternion frame1rot = new IndexedQuaternion(pframe1rot.X, pframe1rot.Y, pframe1rot.Z, pframe1rot.W); | ||
1664 | IndexedMatrix frame1 = IndexedMatrix.CreateFromQuaternion(frame1rot); | ||
1665 | frame1._origin = frame1v; | ||
1666 | |||
1667 | IndexedVector3 frame2v = new IndexedVector3(pframe2.X, pframe2.Y, pframe2.Z); | ||
1668 | IndexedQuaternion frame2rot = new IndexedQuaternion(pframe2rot.X, pframe2rot.Y, pframe2rot.Z, pframe2rot.W); | ||
1669 | IndexedMatrix frame2 = IndexedMatrix.CreateFromQuaternion(frame2rot); | ||
1670 | frame2._origin = frame1v; | ||
1671 | |||
1672 | constrain = new SliderConstraint(rb1, rb2, ref frame1, ref frame2, puseLinearReferenceFrameA); | ||
1673 | world.AddConstraint(constrain, pdisableCollisionsBetweenLinkedBodies); | ||
1674 | } | ||
1675 | return new BulletConstraintXNA(constrain); | ||
1676 | } | ||
1677 | |||
1678 | public override BulletConstraint CreateConeTwistConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2, | ||
1679 | Vector3 pframe1, Quaternion pframe1rot, | ||
1680 | Vector3 pframe2, Quaternion pframe2rot, | ||
1681 | bool pdisableCollisionsBetweenLinkedBodies) | ||
1682 | { | ||
1683 | ConeTwistConstraint constrain = null; | ||
1684 | DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; | ||
1685 | RigidBody rb1 = (pBody1 as BulletBodyXNA).rigidBody; | ||
1686 | RigidBody rb2 = (pBody2 as BulletBodyXNA).rigidBody; | ||
1687 | if (rb1 != null && rb2 != null) | ||
1688 | { | ||
1689 | IndexedVector3 frame1v = new IndexedVector3(pframe1.X, pframe1.Y, pframe1.Z); | ||
1690 | IndexedQuaternion frame1rot = new IndexedQuaternion(pframe1rot.X, pframe1rot.Y, pframe1rot.Z, pframe1rot.W); | ||
1691 | IndexedMatrix frame1 = IndexedMatrix.CreateFromQuaternion(frame1rot); | ||
1692 | frame1._origin = frame1v; | ||
1693 | |||
1694 | IndexedVector3 frame2v = new IndexedVector3(pframe2.X, pframe2.Y, pframe2.Z); | ||
1695 | IndexedQuaternion frame2rot = new IndexedQuaternion(pframe2rot.X, pframe2rot.Y, pframe2rot.Z, pframe2rot.W); | ||
1696 | IndexedMatrix frame2 = IndexedMatrix.CreateFromQuaternion(frame2rot); | ||
1697 | frame2._origin = frame1v; | ||
1698 | |||
1699 | constrain = new ConeTwistConstraint(rb1, rb2, ref frame1, ref frame2); | ||
1700 | world.AddConstraint(constrain, pdisableCollisionsBetweenLinkedBodies); | ||
1701 | } | ||
1702 | return new BulletConstraintXNA(constrain); | ||
1703 | } | ||
1704 | |||
1705 | public override BulletConstraint CreateGearConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2, | ||
1706 | Vector3 paxisInA, Vector3 paxisInB, | ||
1707 | float pratio, bool pdisableCollisionsBetweenLinkedBodies) | ||
1708 | { | ||
1709 | Generic6DofConstraint constrain = null; | ||
1710 | /* BulletXNA does not have a gear constraint | ||
1711 | GearConstraint constrain = null; | ||
1712 | DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; | ||
1713 | RigidBody rb1 = (pBody1 as BulletBodyXNA).rigidBody; | ||
1714 | RigidBody rb2 = (pBody2 as BulletBodyXNA).rigidBody; | ||
1715 | if (rb1 != null && rb2 != null) | ||
1716 | { | ||
1717 | IndexedVector3 axis1 = new IndexedVector3(paxisInA.X, paxisInA.Y, paxisInA.Z); | ||
1718 | IndexedVector3 axis2 = new IndexedVector3(paxisInB.X, paxisInB.Y, paxisInB.Z); | ||
1719 | constrain = new GearConstraint(rb1, rb2, ref axis1, ref axis2, pratio); | ||
1720 | world.AddConstraint(constrain, pdisableCollisionsBetweenLinkedBodies); | ||
1721 | } | ||
1722 | */ | ||
1723 | return new BulletConstraintXNA(constrain); | ||
1724 | } | ||
1725 | |||
1726 | public override BulletConstraint CreatePoint2PointConstraint(BulletWorld pWorld, BulletBody pBody1, BulletBody pBody2, | ||
1727 | Vector3 ppivotInA, Vector3 ppivotInB, | ||
1728 | bool pdisableCollisionsBetweenLinkedBodies) | ||
1729 | { | ||
1730 | Point2PointConstraint constrain = null; | ||
1731 | DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; | ||
1732 | RigidBody rb1 = (pBody1 as BulletBodyXNA).rigidBody; | ||
1733 | RigidBody rb2 = (pBody2 as BulletBodyXNA).rigidBody; | ||
1734 | if (rb1 != null && rb2 != null) | ||
1735 | { | ||
1736 | IndexedVector3 pivotInA = new IndexedVector3(ppivotInA.X, ppivotInA.Y, ppivotInA.Z); | ||
1737 | IndexedVector3 pivotInB = new IndexedVector3(ppivotInB.X, ppivotInB.Y, ppivotInB.Z); | ||
1738 | constrain = new Point2PointConstraint(rb1, rb2, ref pivotInA, ref pivotInB); | ||
1594 | world.AddConstraint(constrain, pdisableCollisionsBetweenLinkedBodies); | 1739 | world.AddConstraint(constrain, pdisableCollisionsBetweenLinkedBodies); |
1595 | } | 1740 | } |
1596 | return new BulletConstraintXNA(constrain); | 1741 | return new BulletConstraintXNA(constrain); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs index 3f83ef0..5765b0d 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs | |||
@@ -365,11 +365,38 @@ public abstract BulletConstraint Create6DofConstraintToPoint(BulletWorld world, | |||
365 | Vector3 joinPoint, | 365 | Vector3 joinPoint, |
366 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | 366 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); |
367 | 367 | ||
368 | public abstract BulletConstraint Create6DofConstraintFixed(BulletWorld world, BulletBody obj1, | ||
369 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
370 | bool useLinearReferenceFrameB, bool disableCollisionsBetweenLinkedBodies); | ||
371 | |||
372 | public abstract BulletConstraint Create6DofSpringConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
373 | Vector3 frame1loc, Quaternion frame1rot, | ||
374 | Vector3 frame2loc, Quaternion frame2rot, | ||
375 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
376 | |||
368 | public abstract BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | 377 | public abstract BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, |
369 | Vector3 pivotinA, Vector3 pivotinB, | 378 | Vector3 pivotinA, Vector3 pivotinB, |
370 | Vector3 axisInA, Vector3 axisInB, | 379 | Vector3 axisInA, Vector3 axisInB, |
371 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | 380 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); |
372 | 381 | ||
382 | public abstract BulletConstraint CreateSliderConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
383 | Vector3 frameInAloc, Quaternion frameInArot, | ||
384 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
385 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); | ||
386 | |||
387 | public abstract BulletConstraint CreateConeTwistConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
388 | Vector3 frameInAloc, Quaternion frameInArot, | ||
389 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
390 | bool disableCollisionsBetweenLinkedBodies); | ||
391 | |||
392 | public abstract BulletConstraint CreateGearConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
393 | Vector3 axisInA, Vector3 axisInB, | ||
394 | float ratio, bool disableCollisionsBetweenLinkedBodies); | ||
395 | |||
396 | public abstract BulletConstraint CreatePoint2PointConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, | ||
397 | Vector3 pivotInA, Vector3 pivotInB, | ||
398 | bool disableCollisionsBetweenLinkedBodies); | ||
399 | |||
373 | public abstract void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse); | 400 | public abstract void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse); |
374 | 401 | ||
375 | public abstract void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations); | 402 | public abstract void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs index ecb1b32..476a0e5 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs | |||
@@ -57,6 +57,7 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
57 | obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString); | 57 | obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString); |
58 | } | 58 | } |
59 | 59 | ||
60 | // 6 Dof constraint based on a midpoint between the two constrained bodies | ||
60 | public BSConstraint6Dof(BulletWorld world, BulletBody obj1, BulletBody obj2, | 61 | public BSConstraint6Dof(BulletWorld world, BulletBody obj1, BulletBody obj2, |
61 | Vector3 joinPoint, | 62 | Vector3 joinPoint, |
62 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | 63 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) |
@@ -94,6 +95,21 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
94 | } | 95 | } |
95 | } | 96 | } |
96 | 97 | ||
98 | // A 6 Dof constraint that is fixed in the world and constrained to a on-the-fly created static object | ||
99 | public BSConstraint6Dof(BulletWorld world, BulletBody obj1, Vector3 frameInBloc, Quaternion frameInBrot, | ||
100 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | ||
101 | : base(world) | ||
102 | { | ||
103 | m_body1 = obj1; | ||
104 | m_body2 = obj1; // Look out for confusion down the road | ||
105 | m_constraint = PhysicsScene.PE.Create6DofConstraintFixed(m_world, m_body1, | ||
106 | frameInBloc, frameInBrot, | ||
107 | useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); | ||
108 | m_enabled = true; | ||
109 | world.physicsScene.DetailLog("{0},BS6DofConstraint,createFixed,wID={1},rID={2},rBody={3}", | ||
110 | BSScene.DetailLogZero, world.worldID, obj1.ID, obj1.AddrString); | ||
111 | } | ||
112 | |||
97 | public bool SetFrames(Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot) | 113 | public bool SetFrames(Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot) |
98 | { | 114 | { |
99 | bool ret = false; | 115 | bool ret = false; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs index 2aeff25..5c8d94e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs | |||
@@ -117,8 +117,7 @@ public sealed class BSConstraintCollection : IDisposable | |||
117 | if (this.TryGetConstraint(body1, body2, out constrain)) | 117 | if (this.TryGetConstraint(body1, body2, out constrain)) |
118 | { | 118 | { |
119 | // remove the constraint from our collection | 119 | // remove the constraint from our collection |
120 | RemoveAndDestroyConstraint(constrain); | 120 | ret = RemoveAndDestroyConstraint(constrain); |
121 | ret = true; | ||
122 | } | 121 | } |
123 | } | 122 | } |
124 | 123 | ||
@@ -126,17 +125,19 @@ public sealed class BSConstraintCollection : IDisposable | |||
126 | } | 125 | } |
127 | 126 | ||
128 | // The constraint MUST exist in the collection | 127 | // The constraint MUST exist in the collection |
128 | // Could be called if the constraint was previously removed. | ||
129 | // Return 'true' if the constraint was actually removed and disposed. | ||
129 | public bool RemoveAndDestroyConstraint(BSConstraint constrain) | 130 | public bool RemoveAndDestroyConstraint(BSConstraint constrain) |
130 | { | 131 | { |
132 | bool removed = false; | ||
131 | lock (m_constraints) | 133 | lock (m_constraints) |
132 | { | 134 | { |
133 | // remove the constraint from our collection | 135 | // remove the constraint from our collection |
134 | m_constraints.Remove(constrain); | 136 | removed = m_constraints.Remove(constrain); |
135 | } | 137 | } |
136 | // tell the engine that all its structures need to be freed | 138 | // Dispose() is safe to call multiple times |
137 | constrain.Dispose(); | 139 | constrain.Dispose(); |
138 | // we destroyed something | 140 | return removed; |
139 | return true; | ||
140 | } | 141 | } |
141 | 142 | ||
142 | // Remove all constraints that reference the passed body. | 143 | // Remove all constraints that reference the passed body. |
diff --git a/bin/lib32/BulletSim.dll b/bin/lib32/BulletSim.dll index e7a8a41..689b34f 100755 --- a/bin/lib32/BulletSim.dll +++ b/bin/lib32/BulletSim.dll | |||
Binary files differ | |||
diff --git a/bin/lib32/libBulletSim.so b/bin/lib32/libBulletSim.so index 4bf23a6..b8c813e 100755 --- a/bin/lib32/libBulletSim.so +++ b/bin/lib32/libBulletSim.so | |||
Binary files differ | |||
diff --git a/bin/lib64/BulletSim.dll b/bin/lib64/BulletSim.dll index 63ac1a9..33c4d08 100755 --- a/bin/lib64/BulletSim.dll +++ b/bin/lib64/BulletSim.dll | |||
Binary files differ | |||
diff --git a/bin/lib64/libBulletSim.so b/bin/lib64/libBulletSim.so index 422681e..79207fe 100755 --- a/bin/lib64/libBulletSim.so +++ b/bin/lib64/libBulletSim.so | |||
Binary files differ | |||