diff options
Diffstat (limited to 'OpenSim/Region/Physics')
17 files changed, 826 insertions, 494 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 39e62dd..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> |
@@ -1133,8 +1151,8 @@ private sealed class BulletConstraintXNA : BulletConstraint | |||
1133 | p.numberOfSolverIterations = o[0].numberOfSolverIterations; | 1151 | p.numberOfSolverIterations = o[0].numberOfSolverIterations; |
1134 | 1152 | ||
1135 | p.linksetImplementation = BSParam.LinksetImplementation; | 1153 | p.linksetImplementation = BSParam.LinksetImplementation; |
1136 | p.linkConstraintUseFrameOffset = BSParam.LinkConstraintUseFrameOffset; | 1154 | p.linkConstraintUseFrameOffset = BSParam.NumericBool(BSParam.LinkConstraintUseFrameOffset); |
1137 | p.linkConstraintEnableTransMotor = BSParam.LinkConstraintEnableTransMotor; | 1155 | p.linkConstraintEnableTransMotor = BSParam.NumericBool(BSParam.LinkConstraintEnableTransMotor); |
1138 | p.linkConstraintTransMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel; | 1156 | p.linkConstraintTransMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel; |
1139 | p.linkConstraintTransMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce; | 1157 | p.linkConstraintTransMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce; |
1140 | p.linkConstraintERP = BSParam.LinkConstraintERP; | 1158 | p.linkConstraintERP = BSParam.LinkConstraintERP; |
@@ -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/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 8dca7c6..1f186c3 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -443,6 +443,7 @@ public sealed class BSCharacter : BSPhysObject | |||
443 | PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate() | 443 | PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate() |
444 | { | 444 | { |
445 | DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 445 | DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
446 | PositionSanityCheck(); | ||
446 | ForcePosition = _position; | 447 | ForcePosition = _position; |
447 | }); | 448 | }); |
448 | } | 449 | } |
@@ -456,7 +457,6 @@ public sealed class BSCharacter : BSPhysObject | |||
456 | _position = value; | 457 | _position = value; |
457 | if (PhysBody.HasPhysicalBody) | 458 | if (PhysBody.HasPhysicalBody) |
458 | { | 459 | { |
459 | PositionSanityCheck(); | ||
460 | PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation); | 460 | PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation); |
461 | } | 461 | } |
462 | } | 462 | } |
@@ -512,9 +512,8 @@ public sealed class BSCharacter : BSPhysObject | |||
512 | // just assign to "Position" because of potential call loops. | 512 | // just assign to "Position" because of potential call loops. |
513 | PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate() | 513 | PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate() |
514 | { | 514 | { |
515 | DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 515 | DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
516 | if (PhysBody.HasPhysicalBody) | 516 | ForcePosition = _position; |
517 | PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation); | ||
518 | }); | 517 | }); |
519 | ret = true; | 518 | ret = true; |
520 | } | 519 | } |
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/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 41d353a..e6933f9 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -144,7 +144,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
144 | enableAngularVerticalAttraction = true; | 144 | enableAngularVerticalAttraction = true; |
145 | enableAngularDeflection = false; | 145 | enableAngularDeflection = false; |
146 | enableAngularBanking = false; | 146 | enableAngularBanking = false; |
147 | if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse) | 147 | if (BSParam.VehicleDebuggingEnabled) |
148 | { | 148 | { |
149 | enableAngularVerticalAttraction = true; | 149 | enableAngularVerticalAttraction = true; |
150 | enableAngularDeflection = false; | 150 | enableAngularDeflection = false; |
@@ -607,8 +607,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
607 | // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. | 607 | // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. |
608 | // Maybe compute linear and angular factor and damping from params. | 608 | // Maybe compute linear and angular factor and damping from params. |
609 | PhysicsScene.PE.SetAngularDamping(Prim.PhysBody, BSParam.VehicleAngularDamping); | 609 | PhysicsScene.PE.SetAngularDamping(Prim.PhysBody, BSParam.VehicleAngularDamping); |
610 | PhysicsScene.PE.SetLinearFactor(Prim.PhysBody, BSParam.VehicleLinearFactorV); | 610 | PhysicsScene.PE.SetLinearFactor(Prim.PhysBody, BSParam.VehicleLinearFactor); |
611 | PhysicsScene.PE.SetAngularFactorV(Prim.PhysBody, BSParam.VehicleAngularFactorV); | 611 | PhysicsScene.PE.SetAngularFactorV(Prim.PhysBody, BSParam.VehicleAngularFactor); |
612 | 612 | ||
613 | // Vehicles report collision events so we know when it's on the ground | 613 | // Vehicles report collision events so we know when it's on the ground |
614 | PhysicsScene.PE.AddToCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); | 614 | PhysicsScene.PE.AddToCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 4ce58c7..e05562a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -485,8 +485,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
485 | } | 485 | } |
486 | OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacement; | 486 | OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacement; |
487 | OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation; | 487 | OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation; |
488 | PhysicsScene.PE.AddChildShapeToCompoundShape(LinksetRoot.PhysShape, cPrim.PhysShape, offsetPos, offsetRot); | 488 | PhysicsScene.PE.AddChildShapeToCompoundShape(LinksetRoot.PhysShape, cPrim.PhysShape, offsetPos, offsetRot); |
489 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addNonNative,indx={1},rShape={2},cShape={3},offPos={4},offRot={5}", | 489 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addNonNative,indx={1},rShape={2},cShape={3},offPos={4},offRot={5}", |
490 | LinksetRoot.LocalID, memberIndex, LinksetRoot.PhysShape, cPrim.PhysShape, offsetPos, offsetRot); | 490 | LinksetRoot.LocalID, memberIndex, LinksetRoot.PhysShape, cPrim.PhysShape, offsetPos, offsetRot); |
491 | 491 | ||
492 | } | 492 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs index cc814d1..6d252ca 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | |||
@@ -223,8 +223,8 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
223 | constrain.SetAngularLimits(OMV.Vector3.Zero, OMV.Vector3.Zero); | 223 | constrain.SetAngularLimits(OMV.Vector3.Zero, OMV.Vector3.Zero); |
224 | 224 | ||
225 | // tweek the constraint to increase stability | 225 | // tweek the constraint to increase stability |
226 | constrain.UseFrameOffset(BSParam.BoolNumeric(BSParam.LinkConstraintUseFrameOffset)); | 226 | constrain.UseFrameOffset(BSParam.LinkConstraintUseFrameOffset); |
227 | constrain.TranslationalLimitMotor(BSParam.BoolNumeric(BSParam.LinkConstraintEnableTransMotor), | 227 | constrain.TranslationalLimitMotor(BSParam.LinkConstraintEnableTransMotor, |
228 | BSParam.LinkConstraintTransMotorMaxVel, | 228 | BSParam.LinkConstraintTransMotorMaxVel, |
229 | BSParam.LinkConstraintTransMotorMaxForce); | 229 | BSParam.LinkConstraintTransMotorMaxForce); |
230 | constrain.SetCFMAndERP(BSParam.LinkConstraintCFM, BSParam.LinkConstraintERP); | 230 | constrain.SetCFMAndERP(BSParam.LinkConstraintCFM, BSParam.LinkConstraintERP); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 329169f..dc57b67 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -37,6 +37,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
37 | { | 37 | { |
38 | public static class BSParam | 38 | public static class BSParam |
39 | { | 39 | { |
40 | private static string LogHeader = "[BULLETSIM PARAMETERS]"; | ||
41 | |||
40 | // Level of Detail values kept as float because that's what the Meshmerizer wants | 42 | // Level of Detail values kept as float because that's what the Meshmerizer wants |
41 | public static float MeshLOD { get; private set; } | 43 | public static float MeshLOD { get; private set; } |
42 | public static float MeshCircularLOD { get; private set; } | 44 | public static float MeshCircularLOD { get; private set; } |
@@ -44,6 +46,8 @@ public static class BSParam | |||
44 | public static float MeshMegaPrimThreshold { get; private set; } | 46 | public static float MeshMegaPrimThreshold { get; private set; } |
45 | public static float SculptLOD { get; private set; } | 47 | public static float SculptLOD { get; private set; } |
46 | 48 | ||
49 | public static int CrossingFailuresBeforeOutOfBounds { get; private set; } | ||
50 | |||
47 | public static float MinimumObjectMass { get; private set; } | 51 | public static float MinimumObjectMass { get; private set; } |
48 | public static float MaximumObjectMass { get; private set; } | 52 | public static float MaximumObjectMass { get; private set; } |
49 | public static float MaxLinearVelocity { get; private set; } | 53 | public static float MaxLinearVelocity { get; private set; } |
@@ -71,24 +75,23 @@ public static class BSParam | |||
71 | public static float TerrainRestitution { get; private set; } | 75 | public static float TerrainRestitution { get; private set; } |
72 | public static float TerrainCollisionMargin { get; private set; } | 76 | public static float TerrainCollisionMargin { get; private set; } |
73 | 77 | ||
74 | public static float DefaultFriction; | 78 | public static float DefaultFriction { get; private set; } |
75 | public static float DefaultDensity; | 79 | public static float DefaultDensity { get; private set; } |
76 | public static float DefaultRestitution; | 80 | public static float DefaultRestitution { get; private set; } |
77 | public static float CollisionMargin; | 81 | public static float CollisionMargin { get; private set; } |
78 | public static float Gravity; | 82 | public static float Gravity { get; private set; } |
79 | 83 | ||
80 | // Physics Engine operation | 84 | // Physics Engine operation |
81 | public static float MaxPersistantManifoldPoolSize; | 85 | public static float MaxPersistantManifoldPoolSize { get; private set; } |
82 | public static float MaxCollisionAlgorithmPoolSize; | 86 | public static float MaxCollisionAlgorithmPoolSize { get; private set; } |
83 | public static float ShouldDisableContactPoolDynamicAllocation; | 87 | public static bool ShouldDisableContactPoolDynamicAllocation { get; private set; } |
84 | public static float ShouldForceUpdateAllAabbs; | 88 | public static bool ShouldForceUpdateAllAabbs { get; private set; } |
85 | public static float ShouldRandomizeSolverOrder; | 89 | public static bool ShouldRandomizeSolverOrder { get; private set; } |
86 | public static float ShouldSplitSimulationIslands; | 90 | public static bool ShouldSplitSimulationIslands { get; private set; } |
87 | public static float ShouldEnableFrictionCaching; | 91 | public static bool ShouldEnableFrictionCaching { get; private set; } |
88 | public static float NumberOfSolverIterations; | 92 | public static float NumberOfSolverIterations { get; private set; } |
89 | public static bool UseSingleSidedMeshes { get { return UseSingleSidedMeshesF != ConfigurationParameters.numericFalse; } } | 93 | public static bool UseSingleSidedMeshes { get; private set; } |
90 | public static float UseSingleSidedMeshesF; | 94 | public static float GlobalContactBreakingThreshold { get; private set; } |
91 | public static float GlobalContactBreakingThreshold; | ||
92 | 95 | ||
93 | // Avatar parameters | 96 | // Avatar parameters |
94 | public static float AvatarFriction { get; private set; } | 97 | public static float AvatarFriction { get; private set; } |
@@ -112,16 +115,15 @@ public static class BSParam | |||
112 | public static float VehicleAngularDamping { get; private set; } | 115 | public static float VehicleAngularDamping { get; private set; } |
113 | public static float VehicleFriction { get; private set; } | 116 | public static float VehicleFriction { get; private set; } |
114 | public static float VehicleRestitution { get; private set; } | 117 | public static float VehicleRestitution { get; private set; } |
115 | public static float VehicleLinearFactor { get; private set; } | 118 | public static Vector3 VehicleLinearFactor { get; private set; } |
116 | public static Vector3 VehicleLinearFactorV { get; private set; } | 119 | public static Vector3 VehicleAngularFactor { get; private set; } |
117 | public static float VehicleAngularFactor { get; private set; } | ||
118 | public static Vector3 VehicleAngularFactorV { get; private set; } | ||
119 | public static float VehicleGroundGravityFudge { get; private set; } | 120 | public static float VehicleGroundGravityFudge { get; private set; } |
120 | public static float VehicleDebuggingEnabled { get; private set; } | 121 | public static bool VehicleDebuggingEnabled { get; private set; } |
121 | 122 | ||
123 | // Linkset implementation parameters | ||
122 | public static float LinksetImplementation { get; private set; } | 124 | public static float LinksetImplementation { get; private set; } |
123 | public static float LinkConstraintUseFrameOffset { get; private set; } | 125 | public static bool LinkConstraintUseFrameOffset { get; private set; } |
124 | public static float LinkConstraintEnableTransMotor { get; private set; } | 126 | public static bool LinkConstraintEnableTransMotor { get; private set; } |
125 | public static float LinkConstraintTransMotorMaxVel { get; private set; } | 127 | public static float LinkConstraintTransMotorMaxVel { get; private set; } |
126 | public static float LinkConstraintTransMotorMaxForce { get; private set; } | 128 | public static float LinkConstraintTransMotorMaxForce { get; private set; } |
127 | public static float LinkConstraintERP { get; private set; } | 129 | public static float LinkConstraintERP { get; private set; } |
@@ -141,40 +143,106 @@ public static class BSParam | |||
141 | public const float MinRestitution = 0f; | 143 | public const float MinRestitution = 0f; |
142 | public const float MaxRestitution = 1f; | 144 | public const float MaxRestitution = 1f; |
143 | 145 | ||
144 | // =========================================================================== | 146 | // ===================================================================================== |
145 | public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val); | 147 | // ===================================================================================== |
146 | public delegate float ParamGet(BSScene scene); | ||
147 | public delegate void ParamSet(BSScene scene, string paramName, uint localID, float val); | ||
148 | public delegate void SetOnObject(BSScene scene, BSPhysObject obj, float val); | ||
149 | 148 | ||
150 | public struct ParameterDefn | 149 | // Base parameter definition that gets and sets parameter values via a string |
150 | public abstract class ParameterDefnBase | ||
151 | { | 151 | { |
152 | public string name; // string name of the parameter | 152 | public string name; // string name of the parameter |
153 | public string desc; // a short description of what the parameter means | 153 | public string desc; // a short description of what the parameter means |
154 | public float defaultValue; // default value if not specified anywhere else | 154 | public ParameterDefnBase(string pName, string pDesc) |
155 | public ParamUser userParam; // get the value from the configuration file | 155 | { |
156 | public ParamGet getter; // return the current value stored for this parameter | 156 | name = pName; |
157 | public ParamSet setter; // set the current value for this parameter | 157 | desc = pDesc; |
158 | public SetOnObject onObject; // set the value on an object in the physical domain | 158 | } |
159 | public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s) | 159 | // Set the parameter value to the default |
160 | public abstract void AssignDefault(BSScene s); | ||
161 | // Get the value as a string | ||
162 | public abstract string GetValue(BSScene s); | ||
163 | // Set the value to this string value | ||
164 | public abstract void SetValue(BSScene s, string valAsString); | ||
165 | // set the value on a particular object (usually sets in physics engine) | ||
166 | public abstract void SetOnObject(BSScene s, BSPhysObject obj); | ||
167 | public abstract bool HasSetOnObject { get; } | ||
168 | } | ||
169 | |||
170 | // Specific parameter definition for a parameter of a specific type. | ||
171 | public delegate T PGetValue<T>(BSScene s); | ||
172 | public delegate void PSetValue<T>(BSScene s, T val); | ||
173 | public delegate void PSetOnObject<T>(BSScene scene, BSPhysObject obj); | ||
174 | public sealed class ParameterDefn<T> : ParameterDefnBase | ||
175 | { | ||
176 | T defaultValue; | ||
177 | PSetValue<T> setter; | ||
178 | PGetValue<T> getter; | ||
179 | PSetOnObject<T> objectSet; | ||
180 | public ParameterDefn(string pName, string pDesc, T pDefault, PGetValue<T> pGetter, PSetValue<T> pSetter) | ||
181 | : base(pName, pDesc) | ||
160 | { | 182 | { |
161 | name = n; | 183 | defaultValue = pDefault; |
162 | desc = d; | 184 | setter = pSetter; |
163 | defaultValue = v; | 185 | getter = pGetter; |
164 | userParam = u; | 186 | objectSet = null; |
165 | getter = g; | ||
166 | setter = s; | ||
167 | onObject = null; | ||
168 | } | 187 | } |
169 | public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s, SetOnObject o) | 188 | public ParameterDefn(string pName, string pDesc, T pDefault, PGetValue<T> pGetter, PSetValue<T> pSetter, PSetOnObject<T> pObjSetter) |
189 | : base(pName, pDesc) | ||
170 | { | 190 | { |
171 | name = n; | 191 | defaultValue = pDefault; |
172 | desc = d; | 192 | setter = pSetter; |
173 | defaultValue = v; | 193 | getter = pGetter; |
174 | userParam = u; | 194 | objectSet = pObjSetter; |
175 | getter = g; | 195 | } |
176 | setter = s; | 196 | public override void AssignDefault(BSScene s) |
177 | onObject = o; | 197 | { |
198 | setter(s, defaultValue); | ||
199 | } | ||
200 | public override string GetValue(BSScene s) | ||
201 | { | ||
202 | return String.Format("{0}", getter(s)); | ||
203 | } | ||
204 | public override void SetValue(BSScene s, string valAsString) | ||
205 | { | ||
206 | // Get the generic type of the setter | ||
207 | Type genericType = setter.GetType().GetGenericArguments()[0]; | ||
208 | // Find the 'Parse' method on that type | ||
209 | System.Reflection.MethodInfo parser = null; | ||
210 | try | ||
211 | { | ||
212 | parser = genericType.GetMethod("Parse", new Type[] { typeof(String) } ); | ||
213 | } | ||
214 | catch (Exception e) | ||
215 | { | ||
216 | s.Logger.ErrorFormat("{0} Exception getting parser for type '{1}': {2}", LogHeader, genericType, e); | ||
217 | parser = null; | ||
218 | } | ||
219 | if (parser != null) | ||
220 | { | ||
221 | // Parse the input string | ||
222 | try | ||
223 | { | ||
224 | T setValue = (T)parser.Invoke(genericType, new Object[] { valAsString }); | ||
225 | setter(s, setValue); | ||
226 | // s.Logger.DebugFormat("{0} Parameter {1} = {2}", LogHeader, name, setValue); | ||
227 | } | ||
228 | catch | ||
229 | { | ||
230 | s.Logger.ErrorFormat("{0} Failed parsing parameter value '{1}' as type '{2}'", LogHeader, valAsString, genericType); | ||
231 | } | ||
232 | } | ||
233 | else | ||
234 | { | ||
235 | s.Logger.ErrorFormat("{0} Could not find parameter parser for type '{1}'", LogHeader, genericType); | ||
236 | } | ||
237 | } | ||
238 | public override bool HasSetOnObject | ||
239 | { | ||
240 | get { return objectSet != null; } | ||
241 | } | ||
242 | public override void SetOnObject(BSScene s, BSPhysObject obj) | ||
243 | { | ||
244 | if (objectSet != null) | ||
245 | objectSet(s, obj); | ||
178 | } | 246 | } |
179 | } | 247 | } |
180 | 248 | ||
@@ -184,462 +252,380 @@ public static class BSParam | |||
184 | // location somewhere in the program and make an entry in this table with the | 252 | // location somewhere in the program and make an entry in this table with the |
185 | // getters and setters. | 253 | // getters and setters. |
186 | // It is easiest to find an existing definition and copy it. | 254 | // It is easiest to find an existing definition and copy it. |
187 | // Parameter values are floats. Booleans are converted to a floating value. | ||
188 | // | 255 | // |
189 | // A ParameterDefn() takes the following parameters: | 256 | // A ParameterDefn<T>() takes the following parameters: |
190 | // -- the text name of the parameter. This is used for console input and ini file. | 257 | // -- the text name of the parameter. This is used for console input and ini file. |
191 | // -- a short text description of the parameter. This shows up in the console listing. | 258 | // -- a short text description of the parameter. This shows up in the console listing. |
192 | // -- a default value (float) | 259 | // -- a default value |
193 | // -- a delegate for fetching the parameter from the ini file. | 260 | // -- a delegate for getting the value |
194 | // Should handle fetching the right type from the ini file and converting it. | 261 | // -- a delegate for setting the value |
195 | // -- a delegate for getting the value as a float | ||
196 | // -- a delegate for setting the value from a float | ||
197 | // -- an optional delegate to update the value in the world. Most often used to | 262 | // -- an optional delegate to update the value in the world. Most often used to |
198 | // push the new value to an in-world object. | 263 | // push the new value to an in-world object. |
199 | // | 264 | // |
200 | // The single letter parameters for the delegates are: | 265 | // The single letter parameters for the delegates are: |
201 | // s = BSScene | 266 | // s = BSScene |
202 | // o = BSPhysObject | 267 | // o = BSPhysObject |
203 | // p = string parameter name | ||
204 | // l = localID of referenced object | ||
205 | // v = value (float) | 268 | // v = value (float) |
206 | // cf = parameter configuration class (for fetching values from ini file) | 269 | private static ParameterDefnBase[] ParameterDefinitions = |
207 | private static ParameterDefn[] ParameterDefinitions = | ||
208 | { | 270 | { |
209 | new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", | 271 | new ParameterDefn<bool>("MeshSculptedPrim", "Whether to create meshes for sculpties", |
210 | ConfigurationParameters.numericTrue, | 272 | true, |
211 | (s,cf,p,v) => { ShouldMeshSculptedPrim = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, | 273 | (s) => { return ShouldMeshSculptedPrim; }, |
212 | (s) => { return BSParam.NumericBool(ShouldMeshSculptedPrim); }, | 274 | (s,v) => { ShouldMeshSculptedPrim = v; } ), |
213 | (s,p,l,v) => { ShouldMeshSculptedPrim = BSParam.BoolNumeric(v); } ), | 275 | new ParameterDefn<bool>("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects", |
214 | new ParameterDefn("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects", | 276 | false, |
215 | ConfigurationParameters.numericFalse, | 277 | (s) => { return ShouldForceSimplePrimMeshing; }, |
216 | (s,cf,p,v) => { ShouldForceSimplePrimMeshing = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, | 278 | (s,v) => { ShouldForceSimplePrimMeshing = v; } ), |
217 | (s) => { return BSParam.NumericBool(ShouldForceSimplePrimMeshing); }, | 279 | new ParameterDefn<bool>("UseHullsForPhysicalObjects", "If true, create hulls for physical objects", |
218 | (s,p,l,v) => { ShouldForceSimplePrimMeshing = BSParam.BoolNumeric(v); } ), | 280 | true, |
219 | new ParameterDefn("UseHullsForPhysicalObjects", "If true, create hulls for physical objects", | 281 | (s) => { return ShouldUseHullsForPhysicalObjects; }, |
220 | ConfigurationParameters.numericTrue, | 282 | (s,v) => { ShouldUseHullsForPhysicalObjects = v; } ), |
221 | (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, | 283 | new ParameterDefn<bool>("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", |
222 | (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, | 284 | true, |
223 | (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), | 285 | (s) => { return ShouldRemoveZeroWidthTriangles; }, |
224 | new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", | 286 | (s,v) => { ShouldRemoveZeroWidthTriangles = v; } ), |
225 | ConfigurationParameters.numericTrue, | 287 | |
226 | (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, | 288 | new ParameterDefn<int>("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", |
227 | (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); }, | 289 | 5, |
228 | (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ), | 290 | (s) => { return CrossingFailuresBeforeOutOfBounds; }, |
229 | 291 | (s,v) => { CrossingFailuresBeforeOutOfBounds = v; } ), | |
230 | new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", | 292 | |
293 | new ParameterDefn<float>("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", | ||
231 | 32f, | 294 | 32f, |
232 | (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); }, | ||
233 | (s) => { return MeshLOD; }, | 295 | (s) => { return MeshLOD; }, |
234 | (s,p,l,v) => { MeshLOD = v; } ), | 296 | (s,v) => { MeshLOD = v; } ), |
235 | new ParameterDefn("MeshLevelOfDetailCircular", "Level of detail for prims with circular cuts or shapes", | 297 | new ParameterDefn<float>("MeshLevelOfDetailCircular", "Level of detail for prims with circular cuts or shapes", |
236 | 32f, | 298 | 32f, |
237 | (s,cf,p,v) => { MeshCircularLOD = (float)cf.GetInt(p, (int)v); }, | ||
238 | (s) => { return MeshCircularLOD; }, | 299 | (s) => { return MeshCircularLOD; }, |
239 | (s,p,l,v) => { MeshCircularLOD = v; } ), | 300 | (s,v) => { MeshCircularLOD = v; } ), |
240 | new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", | 301 | new ParameterDefn<float>("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", |
241 | 10f, | 302 | 10f, |
242 | (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); }, | ||
243 | (s) => { return MeshMegaPrimThreshold; }, | 303 | (s) => { return MeshMegaPrimThreshold; }, |
244 | (s,p,l,v) => { MeshMegaPrimThreshold = v; } ), | 304 | (s,v) => { MeshMegaPrimThreshold = v; } ), |
245 | new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", | 305 | new ParameterDefn<float>("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", |
246 | 32f, | 306 | 32f, |
247 | (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); }, | ||
248 | (s) => { return MeshMegaPrimLOD; }, | 307 | (s) => { return MeshMegaPrimLOD; }, |
249 | (s,p,l,v) => { MeshMegaPrimLOD = v; } ), | 308 | (s,v) => { MeshMegaPrimLOD = v; } ), |
250 | new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", | 309 | new ParameterDefn<float>("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", |
251 | 32f, | 310 | 32f, |
252 | (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); }, | ||
253 | (s) => { return SculptLOD; }, | 311 | (s) => { return SculptLOD; }, |
254 | (s,p,l,v) => { SculptLOD = v; } ), | 312 | (s,v) => { SculptLOD = v; } ), |
255 | 313 | ||
256 | new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps", | 314 | new ParameterDefn<int>("MaxSubStep", "In simulation step, maximum number of substeps", |
257 | 10f, | 315 | 10, |
258 | (s,cf,p,v) => { s.m_maxSubSteps = cf.GetInt(p, (int)v); }, | 316 | (s) => { return s.m_maxSubSteps; }, |
259 | (s) => { return (float)s.m_maxSubSteps; }, | 317 | (s,v) => { s.m_maxSubSteps = (int)v; } ), |
260 | (s,p,l,v) => { s.m_maxSubSteps = (int)v; } ), | 318 | new ParameterDefn<float>("FixedTimeStep", "In simulation step, seconds of one substep (1/60)", |
261 | new ParameterDefn("FixedTimeStep", "In simulation step, seconds of one substep (1/60)", | ||
262 | 1f / 60f, | 319 | 1f / 60f, |
263 | (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); }, | 320 | (s) => { return s.m_fixedTimeStep; }, |
264 | (s) => { return (float)s.m_fixedTimeStep; }, | 321 | (s,v) => { s.m_fixedTimeStep = v; } ), |
265 | (s,p,l,v) => { s.m_fixedTimeStep = v; } ), | 322 | new ParameterDefn<float>("NominalFrameRate", "The base frame rate we claim", |
266 | new ParameterDefn("NominalFrameRate", "The base frame rate we claim", | ||
267 | 55f, | 323 | 55f, |
268 | (s,cf,p,v) => { s.NominalFrameRate = cf.GetInt(p, (int)v); }, | 324 | (s) => { return s.NominalFrameRate; }, |
269 | (s) => { return (float)s.NominalFrameRate; }, | 325 | (s,v) => { s.NominalFrameRate = (int)v; } ), |
270 | (s,p,l,v) => { s.NominalFrameRate = (int)v; } ), | 326 | new ParameterDefn<int>("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", |
271 | new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", | 327 | 2048, |
272 | 2048f, | 328 | (s) => { return s.m_maxCollisionsPerFrame; }, |
273 | (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); }, | 329 | (s,v) => { s.m_maxCollisionsPerFrame = (int)v; } ), |
274 | (s) => { return (float)s.m_maxCollisionsPerFrame; }, | 330 | new ParameterDefn<int>("MaxUpdatesPerFrame", "Max updates returned at end of each frame", |
275 | (s,p,l,v) => { s.m_maxCollisionsPerFrame = (int)v; } ), | 331 | 8000, |
276 | new ParameterDefn("MaxUpdatesPerFrame", "Max updates returned at end of each frame", | 332 | (s) => { return s.m_maxUpdatesPerFrame; }, |
277 | 8000f, | 333 | (s,v) => { s.m_maxUpdatesPerFrame = (int)v; } ), |
278 | (s,cf,p,v) => { s.m_maxUpdatesPerFrame = cf.GetInt(p, (int)v); }, | 334 | |
279 | (s) => { return (float)s.m_maxUpdatesPerFrame; }, | 335 | new ParameterDefn<float>("MinObjectMass", "Minimum object mass (0.0001)", |
280 | (s,p,l,v) => { s.m_maxUpdatesPerFrame = (int)v; } ), | ||
281 | |||
282 | new ParameterDefn("MinObjectMass", "Minimum object mass (0.0001)", | ||
283 | 0.0001f, | 336 | 0.0001f, |
284 | (s,cf,p,v) => { MinimumObjectMass = cf.GetFloat(p, v); }, | ||
285 | (s) => { return MinimumObjectMass; }, | 337 | (s) => { return MinimumObjectMass; }, |
286 | (s,p,l,v) => { MinimumObjectMass = v; } ), | 338 | (s,v) => { MinimumObjectMass = v; } ), |
287 | new ParameterDefn("MaxObjectMass", "Maximum object mass (10000.01)", | 339 | new ParameterDefn<float>("MaxObjectMass", "Maximum object mass (10000.01)", |
288 | 10000.01f, | 340 | 10000.01f, |
289 | (s,cf,p,v) => { MaximumObjectMass = cf.GetFloat(p, v); }, | ||
290 | (s) => { return MaximumObjectMass; }, | 341 | (s) => { return MaximumObjectMass; }, |
291 | (s,p,l,v) => { MaximumObjectMass = v; } ), | 342 | (s,v) => { MaximumObjectMass = v; } ), |
292 | new ParameterDefn("MaxLinearVelocity", "Maximum velocity magnitude that can be assigned to an object", | 343 | new ParameterDefn<float>("MaxLinearVelocity", "Maximum velocity magnitude that can be assigned to an object", |
293 | 1000.0f, | 344 | 1000.0f, |
294 | (s,cf,p,v) => { MaxLinearVelocity = cf.GetFloat(p, v); }, | ||
295 | (s) => { return MaxLinearVelocity; }, | 345 | (s) => { return MaxLinearVelocity; }, |
296 | (s,p,l,v) => { MaxLinearVelocity = v; } ), | 346 | (s,v) => { MaxLinearVelocity = v; } ), |
297 | new ParameterDefn("MaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to an object", | 347 | new ParameterDefn<float>("MaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to an object", |
298 | 1000.0f, | 348 | 1000.0f, |
299 | (s,cf,p,v) => { MaxAngularVelocity = cf.GetFloat(p, v); }, | ||
300 | (s) => { return MaxAngularVelocity; }, | 349 | (s) => { return MaxAngularVelocity; }, |
301 | (s,p,l,v) => { MaxAngularVelocity = v; } ), | 350 | (s,v) => { MaxAngularVelocity = v; } ), |
302 | // LL documentation says thie number should be 20f for llApplyImpulse and 200f for llRezObject | 351 | // LL documentation says thie number should be 20f for llApplyImpulse and 200f for llRezObject |
303 | new ParameterDefn("MaxAddForceMagnitude", "Maximum force that can be applied by llApplyImpulse (SL says 20f)", | 352 | new ParameterDefn<float>("MaxAddForceMagnitude", "Maximum force that can be applied by llApplyImpulse (SL says 20f)", |
304 | 20000.0f, | 353 | 20000.0f, |
305 | (s,cf,p,v) => { MaxAddForceMagnitude = cf.GetFloat(p, v); }, | ||
306 | (s) => { return MaxAddForceMagnitude; }, | 354 | (s) => { return MaxAddForceMagnitude; }, |
307 | (s,p,l,v) => { MaxAddForceMagnitude = v; } ), | 355 | (s,v) => { MaxAddForceMagnitude = v; } ), |
308 | // Density is passed around as 100kg/m3. This scales that to 1kg/m3. | 356 | // Density is passed around as 100kg/m3. This scales that to 1kg/m3. |
309 | new ParameterDefn("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", | 357 | new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", |
310 | 0.01f, | 358 | 0.01f, |
311 | (s,cf,p,v) => { DensityScaleFactor = cf.GetFloat(p, v); }, | ||
312 | (s) => { return DensityScaleFactor; }, | 359 | (s) => { return DensityScaleFactor; }, |
313 | (s,p,l,v) => { DensityScaleFactor = v; } ), | 360 | (s,v) => { DensityScaleFactor = v; } ), |
314 | 361 | ||
315 | new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", | 362 | new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing", |
316 | 2200f, | 363 | 2200f, |
317 | (s,cf,p,v) => { PID_D = cf.GetFloat(p, v); }, | ||
318 | (s) => { return (float)PID_D; }, | 364 | (s) => { return (float)PID_D; }, |
319 | (s,p,l,v) => { PID_D = v; } ), | 365 | (s,v) => { PID_D = v; } ), |
320 | new ParameterDefn("PID_P", "Parameteric factor for motion smoothing", | 366 | new ParameterDefn<float>("PID_P", "Parameteric factor for motion smoothing", |
321 | 900f, | 367 | 900f, |
322 | (s,cf,p,v) => { PID_P = cf.GetFloat(p, v); }, | ||
323 | (s) => { return (float)PID_P; }, | 368 | (s) => { return (float)PID_P; }, |
324 | (s,p,l,v) => { PID_P = v; } ), | 369 | (s,v) => { PID_P = v; } ), |
325 | 370 | ||
326 | new ParameterDefn("DefaultFriction", "Friction factor used on new objects", | 371 | new ParameterDefn<float>("DefaultFriction", "Friction factor used on new objects", |
327 | 0.2f, | 372 | 0.2f, |
328 | (s,cf,p,v) => { DefaultFriction = cf.GetFloat(p, v); }, | ||
329 | (s) => { return DefaultFriction; }, | 373 | (s) => { return DefaultFriction; }, |
330 | (s,p,l,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), | 374 | (s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), |
331 | new ParameterDefn("DefaultDensity", "Density for new objects" , | 375 | new ParameterDefn<float>("DefaultDensity", "Density for new objects" , |
332 | 10.000006836f, // Aluminum g/cm3 | 376 | 10.000006836f, // Aluminum g/cm3 |
333 | (s,cf,p,v) => { DefaultDensity = cf.GetFloat(p, v); }, | ||
334 | (s) => { return DefaultDensity; }, | 377 | (s) => { return DefaultDensity; }, |
335 | (s,p,l,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), | 378 | (s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), |
336 | new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , | 379 | new ParameterDefn<float>("DefaultRestitution", "Bouncyness of an object" , |
337 | 0f, | 380 | 0f, |
338 | (s,cf,p,v) => { DefaultRestitution = cf.GetFloat(p, v); }, | ||
339 | (s) => { return DefaultRestitution; }, | 381 | (s) => { return DefaultRestitution; }, |
340 | (s,p,l,v) => { DefaultRestitution = v; s.UnmanagedParams[0].defaultRestitution = v; } ), | 382 | (s,v) => { DefaultRestitution = v; s.UnmanagedParams[0].defaultRestitution = v; } ), |
341 | new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", | 383 | new ParameterDefn<float>("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", |
342 | 0.04f, | 384 | 0.04f, |
343 | (s,cf,p,v) => { CollisionMargin = cf.GetFloat(p, v); }, | ||
344 | (s) => { return CollisionMargin; }, | 385 | (s) => { return CollisionMargin; }, |
345 | (s,p,l,v) => { CollisionMargin = v; s.UnmanagedParams[0].collisionMargin = v; } ), | 386 | (s,v) => { CollisionMargin = v; s.UnmanagedParams[0].collisionMargin = v; } ), |
346 | new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", | 387 | new ParameterDefn<float>("Gravity", "Vertical force of gravity (negative means down)", |
347 | -9.80665f, | 388 | -9.80665f, |
348 | (s,cf,p,v) => { Gravity = cf.GetFloat(p, v); }, | ||
349 | (s) => { return Gravity; }, | 389 | (s) => { return Gravity; }, |
350 | (s,p,l,v) => { Gravity = v; s.UnmanagedParams[0].gravity = v; }, | 390 | (s,v) => { Gravity = v; s.UnmanagedParams[0].gravity = v; }, |
351 | (s,o,v) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,v)); } ), | 391 | (s,o) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,Gravity)); } ), |
352 | 392 | ||
353 | 393 | ||
354 | new ParameterDefn("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)", | 394 | new ParameterDefn<float>("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)", |
355 | 0f, | 395 | 0f, |
356 | (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); }, | ||
357 | (s) => { return LinearDamping; }, | 396 | (s) => { return LinearDamping; }, |
358 | (s,p,l,v) => { LinearDamping = v; }, | 397 | (s,v) => { LinearDamping = v; }, |
359 | (s,o,v) => { s.PE.SetDamping(o.PhysBody, v, AngularDamping); } ), | 398 | (s,o) => { s.PE.SetDamping(o.PhysBody, LinearDamping, AngularDamping); } ), |
360 | new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", | 399 | new ParameterDefn<float>("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", |
361 | 0f, | 400 | 0f, |
362 | (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); }, | ||
363 | (s) => { return AngularDamping; }, | 401 | (s) => { return AngularDamping; }, |
364 | (s,p,l,v) => { AngularDamping = v; }, | 402 | (s,v) => { AngularDamping = v; }, |
365 | (s,o,v) => { s.PE.SetDamping(o.PhysBody, LinearDamping, v); } ), | 403 | (s,o) => { s.PE.SetDamping(o.PhysBody, LinearDamping, AngularDamping); } ), |
366 | new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", | 404 | new ParameterDefn<float>("DeactivationTime", "Seconds before considering an object potentially static", |
367 | 0.2f, | 405 | 0.2f, |
368 | (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, | ||
369 | (s) => { return DeactivationTime; }, | 406 | (s) => { return DeactivationTime; }, |
370 | (s,p,l,v) => { DeactivationTime = v; }, | 407 | (s,v) => { DeactivationTime = v; }, |
371 | (s,o,v) => { s.PE.SetDeactivationTime(o.PhysBody, v); } ), | 408 | (s,o) => { s.PE.SetDeactivationTime(o.PhysBody, DeactivationTime); } ), |
372 | new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", | 409 | new ParameterDefn<float>("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", |
373 | 0.8f, | 410 | 0.8f, |
374 | (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, | ||
375 | (s) => { return LinearSleepingThreshold; }, | 411 | (s) => { return LinearSleepingThreshold; }, |
376 | (s,p,l,v) => { LinearSleepingThreshold = v;}, | 412 | (s,v) => { LinearSleepingThreshold = v;}, |
377 | (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), | 413 | (s,o) => { s.PE.SetSleepingThresholds(o.PhysBody, LinearSleepingThreshold, AngularSleepingThreshold); } ), |
378 | new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", | 414 | new ParameterDefn<float>("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", |
379 | 1.0f, | 415 | 1.0f, |
380 | (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); }, | ||
381 | (s) => { return AngularSleepingThreshold; }, | 416 | (s) => { return AngularSleepingThreshold; }, |
382 | (s,p,l,v) => { AngularSleepingThreshold = v;}, | 417 | (s,v) => { AngularSleepingThreshold = v;}, |
383 | (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), | 418 | (s,o) => { s.PE.SetSleepingThresholds(o.PhysBody, LinearSleepingThreshold, AngularSleepingThreshold); } ), |
384 | new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , | 419 | new ParameterDefn<float>("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , |
385 | 0.0f, // set to zero to disable | 420 | 0.0f, // set to zero to disable |
386 | (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, | ||
387 | (s) => { return CcdMotionThreshold; }, | 421 | (s) => { return CcdMotionThreshold; }, |
388 | (s,p,l,v) => { CcdMotionThreshold = v;}, | 422 | (s,v) => { CcdMotionThreshold = v;}, |
389 | (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), | 423 | (s,o) => { s.PE.SetCcdMotionThreshold(o.PhysBody, CcdMotionThreshold); } ), |
390 | new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , | 424 | new ParameterDefn<float>("CcdSweptSphereRadius", "Continuious collision detection test radius" , |
391 | 0.2f, | 425 | 0.2f, |
392 | (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, | ||
393 | (s) => { return CcdSweptSphereRadius; }, | 426 | (s) => { return CcdSweptSphereRadius; }, |
394 | (s,p,l,v) => { CcdSweptSphereRadius = v;}, | 427 | (s,v) => { CcdSweptSphereRadius = v;}, |
395 | (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ), | 428 | (s,o) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, CcdSweptSphereRadius); } ), |
396 | new ParameterDefn("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" , | 429 | new ParameterDefn<float>("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" , |
397 | 0.0f, | 430 | 0.0f, |
398 | (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, | ||
399 | (s) => { return ContactProcessingThreshold; }, | 431 | (s) => { return ContactProcessingThreshold; }, |
400 | (s,p,l,v) => { ContactProcessingThreshold = v;}, | 432 | (s,v) => { ContactProcessingThreshold = v;}, |
401 | (s,o,v) => { s.PE.SetContactProcessingThreshold(o.PhysBody, v); } ), | 433 | (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), |
402 | 434 | ||
403 | new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", | 435 | new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", |
404 | (float)BSTerrainPhys.TerrainImplementation.Mesh, | 436 | (float)BSTerrainPhys.TerrainImplementation.Mesh, |
405 | (s,cf,p,v) => { TerrainImplementation = cf.GetFloat(p,v); }, | ||
406 | (s) => { return TerrainImplementation; }, | 437 | (s) => { return TerrainImplementation; }, |
407 | (s,p,l,v) => { TerrainImplementation = v; } ), | 438 | (s,v) => { TerrainImplementation = v; } ), |
408 | new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , | 439 | new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" , |
409 | 0.3f, | 440 | 0.3f, |
410 | (s,cf,p,v) => { TerrainFriction = cf.GetFloat(p, v); }, | ||
411 | (s) => { return TerrainFriction; }, | 441 | (s) => { return TerrainFriction; }, |
412 | (s,p,l,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ), | 442 | (s,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ), |
413 | new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" , | 443 | new ParameterDefn<float>("TerrainHitFraction", "Distance to measure hit collisions" , |
414 | 0.8f, | 444 | 0.8f, |
415 | (s,cf,p,v) => { TerrainHitFraction = cf.GetFloat(p, v); }, | ||
416 | (s) => { return TerrainHitFraction; }, | 445 | (s) => { return TerrainHitFraction; }, |
417 | (s,p,l,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ), | 446 | (s,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ), |
418 | new ParameterDefn("TerrainRestitution", "Bouncyness" , | 447 | new ParameterDefn<float>("TerrainRestitution", "Bouncyness" , |
419 | 0f, | 448 | 0f, |
420 | (s,cf,p,v) => { TerrainRestitution = cf.GetFloat(p, v); }, | ||
421 | (s) => { return TerrainRestitution; }, | 449 | (s) => { return TerrainRestitution; }, |
422 | (s,p,l,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), | 450 | (s,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), |
423 | new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , | 451 | new ParameterDefn<float>("TerrainCollisionMargin", "Margin where collision checking starts" , |
424 | 0.08f, | 452 | 0.08f, |
425 | (s,cf,p,v) => { TerrainCollisionMargin = cf.GetFloat(p, v); }, | ||
426 | (s) => { return TerrainCollisionMargin; }, | 453 | (s) => { return TerrainCollisionMargin; }, |
427 | (s,p,l,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), | 454 | (s,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), |
428 | 455 | ||
429 | new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", | 456 | new ParameterDefn<float>("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", |
430 | 0.2f, | 457 | 0.2f, |
431 | (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); }, | ||
432 | (s) => { return AvatarFriction; }, | 458 | (s) => { return AvatarFriction; }, |
433 | (s,p,l,v) => { AvatarFriction = v; } ), | 459 | (s,v) => { AvatarFriction = v; } ), |
434 | new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", | 460 | new ParameterDefn<float>("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", |
435 | 0.95f, | 461 | 0.95f, |
436 | (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, | ||
437 | (s) => { return AvatarStandingFriction; }, | 462 | (s) => { return AvatarStandingFriction; }, |
438 | (s,p,l,v) => { AvatarStandingFriction = v; } ), | 463 | (s,v) => { AvatarStandingFriction = v; } ), |
439 | new ParameterDefn("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", | 464 | new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", |
440 | 1.3f, | 465 | 1.3f, |
441 | (s,cf,p,v) => { AvatarAlwaysRunFactor = cf.GetFloat(p, v); }, | ||
442 | (s) => { return AvatarAlwaysRunFactor; }, | 466 | (s) => { return AvatarAlwaysRunFactor; }, |
443 | (s,p,l,v) => { AvatarAlwaysRunFactor = v; } ), | 467 | (s,v) => { AvatarAlwaysRunFactor = v; } ), |
444 | new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", | 468 | new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", |
445 | 3.5f, | 469 | 3.5f, |
446 | (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, | ||
447 | (s) => { return AvatarDensity; }, | 470 | (s) => { return AvatarDensity; }, |
448 | (s,p,l,v) => { AvatarDensity = v; } ), | 471 | (s,v) => { AvatarDensity = v; } ), |
449 | new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", | 472 | new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", |
450 | 0f, | 473 | 0f, |
451 | (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); }, | ||
452 | (s) => { return AvatarRestitution; }, | 474 | (s) => { return AvatarRestitution; }, |
453 | (s,p,l,v) => { AvatarRestitution = v; } ), | 475 | (s,v) => { AvatarRestitution = v; } ), |
454 | new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", | 476 | new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", |
455 | 0.6f, | 477 | 0.6f, |
456 | (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); }, | ||
457 | (s) => { return AvatarCapsuleWidth; }, | 478 | (s) => { return AvatarCapsuleWidth; }, |
458 | (s,p,l,v) => { AvatarCapsuleWidth = v; } ), | 479 | (s,v) => { AvatarCapsuleWidth = v; } ), |
459 | new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", | 480 | new ParameterDefn<float>("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", |
460 | 0.45f, | 481 | 0.45f, |
461 | (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); }, | ||
462 | (s) => { return AvatarCapsuleDepth; }, | 482 | (s) => { return AvatarCapsuleDepth; }, |
463 | (s,p,l,v) => { AvatarCapsuleDepth = v; } ), | 483 | (s,v) => { AvatarCapsuleDepth = v; } ), |
464 | new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", | 484 | new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar", |
465 | 1.5f, | 485 | 1.5f, |
466 | (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); }, | ||
467 | (s) => { return AvatarCapsuleHeight; }, | 486 | (s) => { return AvatarCapsuleHeight; }, |
468 | (s,p,l,v) => { AvatarCapsuleHeight = v; } ), | 487 | (s,v) => { AvatarCapsuleHeight = v; } ), |
469 | new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", | 488 | new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", |
470 | 0.1f, | 489 | 0.1f, |
471 | (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); }, | ||
472 | (s) => { return AvatarContactProcessingThreshold; }, | 490 | (s) => { return AvatarContactProcessingThreshold; }, |
473 | (s,p,l,v) => { AvatarContactProcessingThreshold = v; } ), | 491 | (s,v) => { AvatarContactProcessingThreshold = v; } ), |
474 | new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", | 492 | new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction", |
475 | 0.3f, | 493 | 0.3f, |
476 | (s,cf,p,v) => { AvatarStepHeight = cf.GetFloat(p, v); }, | ||
477 | (s) => { return AvatarStepHeight; }, | 494 | (s) => { return AvatarStepHeight; }, |
478 | (s,p,l,v) => { AvatarStepHeight = v; } ), | 495 | (s,v) => { AvatarStepHeight = v; } ), |
479 | new ParameterDefn("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", | 496 | new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", |
480 | 0.6f, | 497 | 0.6f, |
481 | (s,cf,p,v) => { AvatarStepApproachFactor = cf.GetFloat(p, v); }, | ||
482 | (s) => { return AvatarStepApproachFactor; }, | 498 | (s) => { return AvatarStepApproachFactor; }, |
483 | (s,p,l,v) => { AvatarStepApproachFactor = v; } ), | 499 | (s,v) => { AvatarStepApproachFactor = v; } ), |
484 | new ParameterDefn("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", | 500 | new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", |
485 | 2.0f, | 501 | 2.0f, |
486 | (s,cf,p,v) => { AvatarStepForceFactor = cf.GetFloat(p, v); }, | ||
487 | (s) => { return AvatarStepForceFactor; }, | 502 | (s) => { return AvatarStepForceFactor; }, |
488 | (s,p,l,v) => { AvatarStepForceFactor = v; } ), | 503 | (s,v) => { AvatarStepForceFactor = v; } ), |
489 | 504 | ||
490 | new ParameterDefn("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", | 505 | new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", |
491 | 1000.0f, | 506 | 1000.0f, |
492 | (s,cf,p,v) => { VehicleMaxLinearVelocity = cf.GetFloat(p, v); }, | ||
493 | (s) => { return (float)VehicleMaxLinearVelocity; }, | 507 | (s) => { return (float)VehicleMaxLinearVelocity; }, |
494 | (s,p,l,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySq = v * v; } ), | 508 | (s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySq = v * v; } ), |
495 | new ParameterDefn("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", | 509 | new ParameterDefn<float>("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", |
496 | 12.0f, | 510 | 12.0f, |
497 | (s,cf,p,v) => { VehicleMaxAngularVelocity = cf.GetFloat(p, v); }, | ||
498 | (s) => { return (float)VehicleMaxAngularVelocity; }, | 511 | (s) => { return (float)VehicleMaxAngularVelocity; }, |
499 | (s,p,l,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ), | 512 | (s,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ), |
500 | new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", | 513 | new ParameterDefn<float>("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", |
501 | 0.0f, | 514 | 0.0f, |
502 | (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, | ||
503 | (s) => { return VehicleAngularDamping; }, | 515 | (s) => { return VehicleAngularDamping; }, |
504 | (s,p,l,v) => { VehicleAngularDamping = v; } ), | 516 | (s,v) => { VehicleAngularDamping = v; } ), |
505 | new ParameterDefn("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (0.0 - 1.0)", | 517 | new ParameterDefn<Vector3>("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (<0,0,0> to <1,1,1>)", |
506 | 1.0f, | 518 | new Vector3(1f, 1f, 1f), |
507 | (s,cf,p,v) => { VehicleLinearFactor = cf.GetFloat(p, v); }, | ||
508 | (s) => { return VehicleLinearFactor; }, | 519 | (s) => { return VehicleLinearFactor; }, |
509 | (s,p,l,v) => { VehicleLinearFactor = v; VehicleLinearFactorV = new Vector3(v, v, v); } ), | 520 | (s,v) => { VehicleLinearFactor = v; } ), |
510 | new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (0.0 - 1.0)", | 521 | new ParameterDefn<Vector3>("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (<0,0,0> to <1,1,1>)", |
511 | 1.0f, | 522 | new Vector3(1f, 1f, 1f), |
512 | (s,cf,p,v) => { VehicleAngularFactor = cf.GetFloat(p, v); }, | ||
513 | (s) => { return VehicleAngularFactor; }, | 523 | (s) => { return VehicleAngularFactor; }, |
514 | (s,p,l,v) => { VehicleAngularFactor = v; VehicleAngularFactorV = new Vector3(v, v, v); } ), | 524 | (s,v) => { VehicleAngularFactor = v; } ), |
515 | new ParameterDefn("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)", | 525 | new ParameterDefn<float>("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)", |
516 | 0.0f, | 526 | 0.0f, |
517 | (s,cf,p,v) => { VehicleFriction = cf.GetFloat(p, v); }, | ||
518 | (s) => { return VehicleFriction; }, | 527 | (s) => { return VehicleFriction; }, |
519 | (s,p,l,v) => { VehicleFriction = v; } ), | 528 | (s,v) => { VehicleFriction = v; } ), |
520 | new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", | 529 | new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", |
521 | 0.0f, | 530 | 0.0f, |
522 | (s,cf,p,v) => { VehicleRestitution = cf.GetFloat(p, v); }, | ||
523 | (s) => { return VehicleRestitution; }, | 531 | (s) => { return VehicleRestitution; }, |
524 | (s,p,l,v) => { VehicleRestitution = v; } ), | 532 | (s,v) => { VehicleRestitution = v; } ), |
525 | new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", | 533 | new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", |
526 | 0.2f, | 534 | 0.2f, |
527 | (s,cf,p,v) => { VehicleGroundGravityFudge = cf.GetFloat(p, v); }, | ||
528 | (s) => { return VehicleGroundGravityFudge; }, | 535 | (s) => { return VehicleGroundGravityFudge; }, |
529 | (s,p,l,v) => { VehicleGroundGravityFudge = v; } ), | 536 | (s,v) => { VehicleGroundGravityFudge = v; } ), |
530 | new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", | 537 | new ParameterDefn<bool>("VehicleDebuggingEnable", "Turn on/off vehicle debugging", |
531 | ConfigurationParameters.numericFalse, | 538 | false, |
532 | (s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
533 | (s) => { return VehicleDebuggingEnabled; }, | 539 | (s) => { return VehicleDebuggingEnabled; }, |
534 | (s,p,l,v) => { VehicleDebuggingEnabled = v; } ), | 540 | (s,v) => { VehicleDebuggingEnabled = v; } ), |
535 | 541 | ||
536 | new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", | 542 | new ParameterDefn<float>("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", |
537 | 0f, | 543 | 0f, |
538 | (s,cf,p,v) => { MaxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, | ||
539 | (s) => { return MaxPersistantManifoldPoolSize; }, | 544 | (s) => { return MaxPersistantManifoldPoolSize; }, |
540 | (s,p,l,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), | 545 | (s,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), |
541 | new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", | 546 | new ParameterDefn<float>("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", |
542 | 0f, | 547 | 0f, |
543 | (s,cf,p,v) => { MaxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, | ||
544 | (s) => { return MaxCollisionAlgorithmPoolSize; }, | 548 | (s) => { return MaxCollisionAlgorithmPoolSize; }, |
545 | (s,p,l,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), | 549 | (s,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), |
546 | new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", | 550 | new ParameterDefn<bool>("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", |
547 | ConfigurationParameters.numericFalse, | 551 | false, |
548 | (s,cf,p,v) => { ShouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
549 | (s) => { return ShouldDisableContactPoolDynamicAllocation; }, | 552 | (s) => { return ShouldDisableContactPoolDynamicAllocation; }, |
550 | (s,p,l,v) => { ShouldDisableContactPoolDynamicAllocation = v; s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), | 553 | (s,v) => { ShouldDisableContactPoolDynamicAllocation = v; |
551 | new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", | 554 | s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = NumericBool(v); } ), |
552 | ConfigurationParameters.numericFalse, | 555 | new ParameterDefn<bool>("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", |
553 | (s,cf,p,v) => { ShouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | 556 | false, |
554 | (s) => { return ShouldForceUpdateAllAabbs; }, | 557 | (s) => { return ShouldForceUpdateAllAabbs; }, |
555 | (s,p,l,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), | 558 | (s,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = NumericBool(v); } ), |
556 | new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", | 559 | new ParameterDefn<bool>("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", |
557 | ConfigurationParameters.numericTrue, | 560 | true, |
558 | (s,cf,p,v) => { ShouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
559 | (s) => { return ShouldRandomizeSolverOrder; }, | 561 | (s) => { return ShouldRandomizeSolverOrder; }, |
560 | (s,p,l,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), | 562 | (s,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = NumericBool(v); } ), |
561 | new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", | 563 | new ParameterDefn<bool>("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", |
562 | ConfigurationParameters.numericTrue, | 564 | true, |
563 | (s,cf,p,v) => { ShouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
564 | (s) => { return ShouldSplitSimulationIslands; }, | 565 | (s) => { return ShouldSplitSimulationIslands; }, |
565 | (s,p,l,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), | 566 | (s,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = NumericBool(v); } ), |
566 | new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", | 567 | new ParameterDefn<bool>("ShouldEnableFrictionCaching", "Enable friction computation caching", |
567 | ConfigurationParameters.numericTrue, | 568 | true, |
568 | (s,cf,p,v) => { ShouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
569 | (s) => { return ShouldEnableFrictionCaching; }, | 569 | (s) => { return ShouldEnableFrictionCaching; }, |
570 | (s,p,l,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), | 570 | (s,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = NumericBool(v); } ), |
571 | new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", | 571 | new ParameterDefn<float>("NumberOfSolverIterations", "Number of internal iterations (0 means default)", |
572 | 0f, // zero says use Bullet default | 572 | 0f, // zero says use Bullet default |
573 | (s,cf,p,v) => { NumberOfSolverIterations = cf.GetFloat(p, v); }, | ||
574 | (s) => { return NumberOfSolverIterations; }, | 573 | (s) => { return NumberOfSolverIterations; }, |
575 | (s,p,l,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ), | 574 | (s,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ), |
576 | new ParameterDefn("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.", | 575 | new ParameterDefn<bool>("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.", |
577 | ConfigurationParameters.numericTrue, | 576 | true, |
578 | (s,cf,p,v) => { UseSingleSidedMeshesF = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | 577 | (s) => { return UseSingleSidedMeshes; }, |
579 | (s) => { return UseSingleSidedMeshesF; }, | 578 | (s,v) => { UseSingleSidedMeshes = v; s.UnmanagedParams[0].useSingleSidedMeshes = NumericBool(v); } ), |
580 | (s,p,l,v) => { UseSingleSidedMeshesF = v; s.UnmanagedParams[0].useSingleSidedMeshes = v; } ), | 579 | new ParameterDefn<float>("GlobalContactBreakingThreshold", "Amount of shape radius before breaking a collision contact (0 says Bullet default (0.2))", |
581 | new ParameterDefn("GlobalContactBreakingThreshold", "Amount of shape radius before breaking a collision contact (0 says Bullet default (0.2))", | ||
582 | 0f, | 580 | 0f, |
583 | (s,cf,p,v) => { GlobalContactBreakingThreshold = cf.GetFloat(p, v); }, | ||
584 | (s) => { return GlobalContactBreakingThreshold; }, | 581 | (s) => { return GlobalContactBreakingThreshold; }, |
585 | (s,p,l,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), | 582 | (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), |
586 | 583 | ||
587 | new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", | 584 | new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", |
588 | (float)BSLinkset.LinksetImplementation.Compound, | 585 | (float)BSLinkset.LinksetImplementation.Compound, |
589 | (s,cf,p,v) => { LinksetImplementation = cf.GetFloat(p,v); }, | ||
590 | (s) => { return LinksetImplementation; }, | 586 | (s) => { return LinksetImplementation; }, |
591 | (s,p,l,v) => { LinksetImplementation = v; } ), | 587 | (s,v) => { LinksetImplementation = v; } ), |
592 | new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", | 588 | new ParameterDefn<bool>("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", |
593 | ConfigurationParameters.numericFalse, | 589 | false, |
594 | (s,cf,p,v) => { LinkConstraintUseFrameOffset = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
595 | (s) => { return LinkConstraintUseFrameOffset; }, | 590 | (s) => { return LinkConstraintUseFrameOffset; }, |
596 | (s,p,l,v) => { LinkConstraintUseFrameOffset = v; } ), | 591 | (s,v) => { LinkConstraintUseFrameOffset = v; } ), |
597 | new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", | 592 | new ParameterDefn<bool>("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", |
598 | ConfigurationParameters.numericTrue, | 593 | true, |
599 | (s,cf,p,v) => { LinkConstraintEnableTransMotor = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
600 | (s) => { return LinkConstraintEnableTransMotor; }, | 594 | (s) => { return LinkConstraintEnableTransMotor; }, |
601 | (s,p,l,v) => { LinkConstraintEnableTransMotor = v; } ), | 595 | (s,v) => { LinkConstraintEnableTransMotor = v; } ), |
602 | new ParameterDefn("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", | 596 | new ParameterDefn<float>("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", |
603 | 5.0f, | 597 | 5.0f, |
604 | (s,cf,p,v) => { LinkConstraintTransMotorMaxVel = cf.GetFloat(p, v); }, | ||
605 | (s) => { return LinkConstraintTransMotorMaxVel; }, | 598 | (s) => { return LinkConstraintTransMotorMaxVel; }, |
606 | (s,p,l,v) => { LinkConstraintTransMotorMaxVel = v; } ), | 599 | (s,v) => { LinkConstraintTransMotorMaxVel = v; } ), |
607 | new ParameterDefn("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", | 600 | new ParameterDefn<float>("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", |
608 | 0.1f, | 601 | 0.1f, |
609 | (s,cf,p,v) => { LinkConstraintTransMotorMaxForce = cf.GetFloat(p, v); }, | ||
610 | (s) => { return LinkConstraintTransMotorMaxForce; }, | 602 | (s) => { return LinkConstraintTransMotorMaxForce; }, |
611 | (s,p,l,v) => { LinkConstraintTransMotorMaxForce = v; } ), | 603 | (s,v) => { LinkConstraintTransMotorMaxForce = v; } ), |
612 | new ParameterDefn("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", | 604 | new ParameterDefn<float>("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", |
613 | 0.1f, | 605 | 0.1f, |
614 | (s,cf,p,v) => { LinkConstraintCFM = cf.GetFloat(p, v); }, | ||
615 | (s) => { return LinkConstraintCFM; }, | 606 | (s) => { return LinkConstraintCFM; }, |
616 | (s,p,l,v) => { LinkConstraintCFM = v; } ), | 607 | (s,v) => { LinkConstraintCFM = v; } ), |
617 | new ParameterDefn("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", | 608 | new ParameterDefn<float>("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", |
618 | 0.1f, | 609 | 0.1f, |
619 | (s,cf,p,v) => { LinkConstraintERP = cf.GetFloat(p, v); }, | ||
620 | (s) => { return LinkConstraintERP; }, | 610 | (s) => { return LinkConstraintERP; }, |
621 | (s,p,l,v) => { LinkConstraintERP = v; } ), | 611 | (s,v) => { LinkConstraintERP = v; } ), |
622 | new ParameterDefn("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", | 612 | new ParameterDefn<float>("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", |
623 | 40, | 613 | 40, |
624 | (s,cf,p,v) => { LinkConstraintSolverIterations = cf.GetFloat(p, v); }, | ||
625 | (s) => { return LinkConstraintSolverIterations; }, | 614 | (s) => { return LinkConstraintSolverIterations; }, |
626 | (s,p,l,v) => { LinkConstraintSolverIterations = v; } ), | 615 | (s,v) => { LinkConstraintSolverIterations = v; } ), |
627 | 616 | ||
628 | new ParameterDefn("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)", | 617 | new ParameterDefn<int>("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)", |
629 | 0f, | 618 | 0, |
630 | (s,cf,p,v) => { s.PhysicsMetricDumpFrames = cf.GetFloat(p, (int)v); }, | 619 | (s) => { return s.PhysicsMetricDumpFrames; }, |
631 | (s) => { return (float)s.PhysicsMetricDumpFrames; }, | 620 | (s,v) => { s.PhysicsMetricDumpFrames = v; } ), |
632 | (s,p,l,v) => { s.PhysicsMetricDumpFrames = (int)v; } ), | 621 | new ParameterDefn<float>("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool", |
633 | new ParameterDefn("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool", | ||
634 | 0f, | 622 | 0f, |
635 | (s,cf,p,v) => { ; }, | ||
636 | (s) => { return 0f; }, | 623 | (s) => { return 0f; }, |
637 | (s,p,l,v) => { BSParam.ResetBroadphasePoolTainted(s, v); } ), | 624 | (s,v) => { BSParam.ResetBroadphasePoolTainted(s, v); } ), |
638 | new ParameterDefn("ResetConstraintSolver", "Setting this is any value resets the constraint solver", | 625 | new ParameterDefn<float>("ResetConstraintSolver", "Setting this is any value resets the constraint solver", |
639 | 0f, | 626 | 0f, |
640 | (s,cf,p,v) => { ; }, | ||
641 | (s) => { return 0f; }, | 627 | (s) => { return 0f; }, |
642 | (s,p,l,v) => { BSParam.ResetConstraintSolverTainted(s, v); } ), | 628 | (s,v) => { BSParam.ResetConstraintSolverTainted(s, v); } ), |
643 | }; | 629 | }; |
644 | 630 | ||
645 | // Convert a boolean to our numeric true and false values | 631 | // Convert a boolean to our numeric true and false values |
@@ -658,13 +644,13 @@ public static class BSParam | |||
658 | // ParameterDefn structure. | 644 | // ParameterDefn structure. |
659 | // Case does not matter as names are compared after converting to lower case. | 645 | // Case does not matter as names are compared after converting to lower case. |
660 | // Returns 'false' if the parameter is not found. | 646 | // Returns 'false' if the parameter is not found. |
661 | internal static bool TryGetParameter(string paramName, out ParameterDefn defn) | 647 | internal static bool TryGetParameter(string paramName, out ParameterDefnBase defn) |
662 | { | 648 | { |
663 | bool ret = false; | 649 | bool ret = false; |
664 | ParameterDefn foundDefn = new ParameterDefn(); | 650 | ParameterDefnBase foundDefn = null; |
665 | string pName = paramName.ToLower(); | 651 | string pName = paramName.ToLower(); |
666 | 652 | ||
667 | foreach (ParameterDefn parm in ParameterDefinitions) | 653 | foreach (ParameterDefnBase parm in ParameterDefinitions) |
668 | { | 654 | { |
669 | if (pName == parm.name.ToLower()) | 655 | if (pName == parm.name.ToLower()) |
670 | { | 656 | { |
@@ -680,18 +666,18 @@ public static class BSParam | |||
680 | // Pass through the settable parameters and set the default values | 666 | // Pass through the settable parameters and set the default values |
681 | internal static void SetParameterDefaultValues(BSScene physicsScene) | 667 | internal static void SetParameterDefaultValues(BSScene physicsScene) |
682 | { | 668 | { |
683 | foreach (ParameterDefn parm in ParameterDefinitions) | 669 | foreach (ParameterDefnBase parm in ParameterDefinitions) |
684 | { | 670 | { |
685 | parm.setter(physicsScene, parm.name, PhysParameterEntry.APPLY_TO_NONE, parm.defaultValue); | 671 | parm.AssignDefault(physicsScene); |
686 | } | 672 | } |
687 | } | 673 | } |
688 | 674 | ||
689 | // Get user set values out of the ini file. | 675 | // Get user set values out of the ini file. |
690 | internal static void SetParameterConfigurationValues(BSScene physicsScene, IConfig cfg) | 676 | internal static void SetParameterConfigurationValues(BSScene physicsScene, IConfig cfg) |
691 | { | 677 | { |
692 | foreach (ParameterDefn parm in ParameterDefinitions) | 678 | foreach (ParameterDefnBase parm in ParameterDefinitions) |
693 | { | 679 | { |
694 | parm.userParam(physicsScene, cfg, parm.name, parm.defaultValue); | 680 | parm.SetValue(physicsScene, cfg.GetString(parm.name, parm.GetValue(physicsScene))); |
695 | } | 681 | } |
696 | } | 682 | } |
697 | 683 | ||
@@ -706,17 +692,21 @@ public static class BSParam | |||
706 | List<PhysParameterEntry> entries = new List<PhysParameterEntry>(); | 692 | List<PhysParameterEntry> entries = new List<PhysParameterEntry>(); |
707 | for (int ii = 0; ii < ParameterDefinitions.Length; ii++) | 693 | for (int ii = 0; ii < ParameterDefinitions.Length; ii++) |
708 | { | 694 | { |
709 | ParameterDefn pd = ParameterDefinitions[ii]; | 695 | ParameterDefnBase pd = ParameterDefinitions[ii]; |
710 | entries.Add(new PhysParameterEntry(pd.name, pd.desc)); | 696 | entries.Add(new PhysParameterEntry(pd.name, pd.desc)); |
711 | } | 697 | } |
712 | 698 | ||
713 | // make the list alphabetical for estetic reasons | 699 | // make the list alphabetical for ease of finding anything |
714 | entries.Sort((ppe1, ppe2) => { return ppe1.name.CompareTo(ppe2.name); }); | 700 | entries.Sort((ppe1, ppe2) => { return ppe1.name.CompareTo(ppe2.name); }); |
715 | 701 | ||
716 | SettableParameters = entries.ToArray(); | 702 | SettableParameters = entries.ToArray(); |
717 | } | 703 | } |
718 | } | 704 | } |
719 | 705 | ||
706 | // ===================================================================== | ||
707 | // ===================================================================== | ||
708 | // There are parameters that, when set, cause things to happen in the physics engine. | ||
709 | // This causes the broadphase collision cache to be cleared. | ||
720 | private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v) | 710 | private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v) |
721 | { | 711 | { |
722 | BSScene physScene = pPhysScene; | 712 | BSScene physScene = pPhysScene; |
@@ -726,6 +716,7 @@ public static class BSParam | |||
726 | }); | 716 | }); |
727 | } | 717 | } |
728 | 718 | ||
719 | // This causes the constraint solver cache to be cleared and reset. | ||
729 | private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v) | 720 | private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v) |
730 | { | 721 | { |
731 | BSScene physScene = pPhysScene; | 722 | BSScene physScene = pPhysScene; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 0323b0d..4dff927 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -70,6 +70,8 @@ public class BSPrim : BSPhysObject | |||
70 | private bool _kinematic; | 70 | private bool _kinematic; |
71 | private float _buoyancy; | 71 | private float _buoyancy; |
72 | 72 | ||
73 | private int CrossingFailures { get; set; } | ||
74 | |||
73 | public BSDynamics VehicleController { get; private set; } | 75 | public BSDynamics VehicleController { get; private set; } |
74 | 76 | ||
75 | private BSVMotor _targetMotor; | 77 | private BSVMotor _targetMotor; |
@@ -197,7 +199,20 @@ public class BSPrim : BSPhysObject | |||
197 | { | 199 | { |
198 | get { return _isSelected; } | 200 | get { return _isSelected; } |
199 | } | 201 | } |
200 | public override void CrossingFailure() { return; } | 202 | |
203 | public override void CrossingFailure() | ||
204 | { | ||
205 | CrossingFailures++; | ||
206 | if (CrossingFailures > BSParam.CrossingFailuresBeforeOutOfBounds) | ||
207 | { | ||
208 | base.RaiseOutOfBounds(RawPosition); | ||
209 | } | ||
210 | else if (CrossingFailures == BSParam.CrossingFailuresBeforeOutOfBounds) | ||
211 | { | ||
212 | m_log.WarnFormat("{0} Too many crossing failures for {1}", LogHeader, Name); | ||
213 | } | ||
214 | return; | ||
215 | } | ||
201 | 216 | ||
202 | // link me to the specified parent | 217 | // link me to the specified parent |
203 | public override void link(PhysicsActor obj) { | 218 | public override void link(PhysicsActor obj) { |
@@ -239,50 +254,98 @@ public class BSPrim : BSPhysObject | |||
239 | }); | 254 | }); |
240 | } | 255 | } |
241 | 256 | ||
257 | bool TryExperimentalLockAxisCode = false; | ||
258 | BSConstraint LockAxisConstraint = null; | ||
242 | public override void LockAngularMotion(OMV.Vector3 axis) | 259 | public override void LockAngularMotion(OMV.Vector3 axis) |
243 | { | 260 | { |
244 | DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis); | 261 | DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis); |
245 | 262 | ||
263 | // "1" means free, "0" means locked | ||
246 | OMV.Vector3 locking = new OMV.Vector3(1f, 1f, 1f); | 264 | OMV.Vector3 locking = new OMV.Vector3(1f, 1f, 1f); |
247 | if (axis.X != 1) locking.X = 0f; | 265 | if (axis.X != 1) locking.X = 0f; |
248 | if (axis.Y != 1) locking.Y = 0f; | 266 | if (axis.Y != 1) locking.Y = 0f; |
249 | if (axis.Z != 1) locking.Z = 0f; | 267 | if (axis.Z != 1) locking.Z = 0f; |
250 | LockedAxis = locking; | 268 | LockedAxis = locking; |
251 | 269 | ||
252 | /* Not implemented yet | 270 | if (TryExperimentalLockAxisCode && LockedAxis != LockedAxisFree) |
253 | if (LockedAxis != LockedAxisFree) | ||
254 | { | 271 | { |
255 | // Something is locked so start the thingy that keeps that axis from changing | 272 | // Lock that axis by creating a 6DOF constraint that has one end in the world and |
256 | RegisterPreUpdatePropertyAction("BSPrim.LockAngularMotion", delegate(ref EntityProperties entprop) | 273 | // the other in the object. |
274 | // http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=20817 | ||
275 | // http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=26380 | ||
276 | |||
277 | PhysicsScene.TaintedObject("BSPrim.LockAngularMotion", delegate() | ||
257 | { | 278 | { |
258 | if (LockedAxis != LockedAxisFree) | 279 | CleanUpLockAxisPhysicals(true /* inTaintTime */); |
280 | |||
281 | BSConstraint6Dof axisConstrainer = new BSConstraint6Dof(PhysicsScene.World, PhysBody, | ||
282 | OMV.Vector3.Zero, OMV.Quaternion.Inverse(RawOrientation), | ||
283 | true /* useLinearReferenceFrameB */, true /* disableCollisionsBetweenLinkedBodies */); | ||
284 | LockAxisConstraint = axisConstrainer; | ||
285 | PhysicsScene.Constraints.AddConstraint(LockAxisConstraint); | ||
286 | |||
287 | // The constraint is tied to the world and oriented to the prim. | ||
288 | |||
289 | // Free to move linearly | ||
290 | OMV.Vector3 linearLow = OMV.Vector3.Zero; | ||
291 | OMV.Vector3 linearHigh = PhysicsScene.TerrainManager.DefaultRegionSize; | ||
292 | axisConstrainer.SetLinearLimits(linearLow, linearHigh); | ||
293 | |||
294 | // Angular with some axis locked | ||
295 | float f2PI = (float)Math.PI * 2f; | ||
296 | OMV.Vector3 angularLow = new OMV.Vector3(-f2PI, -f2PI, -f2PI); | ||
297 | OMV.Vector3 angularHigh = new OMV.Vector3(f2PI, f2PI, f2PI); | ||
298 | if (LockedAxis.X != 1f) | ||
259 | { | 299 | { |
260 | if (IsPhysicallyActive) | 300 | angularLow.X = 0f; |
261 | { | 301 | angularHigh.X = 0f; |
262 | // Bullet can lock axis but it only works for global axis. | ||
263 | // Check if this prim is aligned on global axis and use Bullet's | ||
264 | // system if so. | ||
265 | |||
266 | ForceOrientation = entprop.Rotation; | ||
267 | ForceRotationalVelocity = entprop.RotationalVelocity; | ||
268 | } | ||
269 | } | 302 | } |
270 | else | 303 | if (LockedAxis.Y != 1f) |
304 | { | ||
305 | angularLow.Y = 0f; | ||
306 | angularHigh.Y = 0f; | ||
307 | } | ||
308 | if (LockedAxis.Z != 1f) | ||
271 | { | 309 | { |
272 | UnRegisterPreUpdatePropertyAction("BSPrim.LockAngularMotion"); | 310 | angularLow.Z = 0f; |
311 | angularHigh.Z = 0f; | ||
273 | } | 312 | } |
313 | axisConstrainer.SetAngularLimits(angularLow, angularHigh); | ||
314 | |||
315 | DetailLog("{0},BSPrim.LockAngularMotion,create,linLow={1},linHi={2},angLow={3},angHi={4}", | ||
316 | LocalID, linearLow, linearHigh, angularLow, angularHigh); | ||
274 | 317 | ||
318 | // Constants from one of the posts mentioned above and used in Bullet's ConstraintDemo. | ||
319 | axisConstrainer.TranslationalLimitMotor(true /* enable */, 5.0f, 0.1f); | ||
320 | |||
321 | axisConstrainer.RecomputeConstraintVariables(RawMass); | ||
275 | }); | 322 | }); |
276 | } | 323 | } |
277 | else | 324 | else |
278 | { | 325 | { |
279 | // Everything seems unlocked | 326 | // Everything seems unlocked |
280 | UnRegisterPreUpdatePropertyAction("BSPrim.LockAngularMotion"); | 327 | CleanUpLockAxisPhysicals(false /* inTaintTime */); |
281 | } | 328 | } |
282 | */ | ||
283 | 329 | ||
284 | return; | 330 | return; |
285 | } | 331 | } |
332 | // Get rid of any constraint built for LockAxis | ||
333 | // Most often the constraint is removed when the constraint collection is cleaned for this prim. | ||
334 | private void CleanUpLockAxisPhysicals(bool inTaintTime) | ||
335 | { | ||
336 | if (LockAxisConstraint != null) | ||
337 | { | ||
338 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.CleanUpLockAxisPhysicals", delegate() | ||
339 | { | ||
340 | if (LockAxisConstraint != null) | ||
341 | { | ||
342 | PhysicsScene.Constraints.RemoveAndDestroyConstraint(LockAxisConstraint); | ||
343 | LockAxisConstraint = null; | ||
344 | DetailLog("{0},BSPrim.CleanUpLockAxisPhysicals,destroyingConstraint", LocalID); | ||
345 | } | ||
346 | }); | ||
347 | } | ||
348 | } | ||
286 | 349 | ||
287 | public override OMV.Vector3 RawPosition | 350 | public override OMV.Vector3 RawPosition |
288 | { | 351 | { |
@@ -762,6 +825,7 @@ public class BSPrim : BSPhysObject | |||
762 | SetObjectDynamic(true); | 825 | SetObjectDynamic(true); |
763 | // whether phys-to-static or static-to-phys, the object is not moving. | 826 | // whether phys-to-static or static-to-phys, the object is not moving. |
764 | ZeroMotion(true); | 827 | ZeroMotion(true); |
828 | |||
765 | }); | 829 | }); |
766 | } | 830 | } |
767 | } | 831 | } |
@@ -885,6 +949,8 @@ public class BSPrim : BSPhysObject | |||
885 | 949 | ||
886 | // For good measure, make sure the transform is set through to the motion state | 950 | // For good measure, make sure the transform is set through to the motion state |
887 | ForcePosition = _position; | 951 | ForcePosition = _position; |
952 | ForceVelocity = _velocity; | ||
953 | ForceRotationalVelocity = _rotationalVelocity; | ||
888 | 954 | ||
889 | // A dynamic object has mass | 955 | // A dynamic object has mass |
890 | UpdatePhysicalMassProperties(RawMass, false); | 956 | UpdatePhysicalMassProperties(RawMass, false); |
@@ -1064,15 +1130,19 @@ public class BSPrim : BSPhysObject | |||
1064 | _buoyancy = value; | 1130 | _buoyancy = value; |
1065 | // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); | 1131 | // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); |
1066 | // Force the recalculation of the various inertia,etc variables in the object | 1132 | // Force the recalculation of the various inertia,etc variables in the object |
1067 | DetailLog("{0},BSPrim.ForceBuoyancy,buoy={1},mass={2}", LocalID, _buoyancy, _mass); | 1133 | UpdatePhysicalMassProperties(RawMass, true); |
1068 | UpdatePhysicalMassProperties(_mass, true); | 1134 | DetailLog("{0},BSPrim.ForceBuoyancy,buoy={1},mass={2},grav={3}", LocalID, _buoyancy, RawMass, Gravity); |
1069 | ActivateIfPhysical(false); | 1135 | ActivateIfPhysical(false); |
1070 | } | 1136 | } |
1071 | } | 1137 | } |
1072 | 1138 | ||
1073 | // Used for MoveTo | 1139 | // Used for MoveTo |
1074 | public override OMV.Vector3 PIDTarget { | 1140 | public override OMV.Vector3 PIDTarget { |
1075 | set { _PIDTarget = value; } | 1141 | set |
1142 | { | ||
1143 | // TODO: add a sanity check -- don't move more than a region or something like that. | ||
1144 | _PIDTarget = value; | ||
1145 | } | ||
1076 | } | 1146 | } |
1077 | public override float PIDTau { | 1147 | public override float PIDTau { |
1078 | set { _PIDTau = value; } | 1148 | set { _PIDTau = value; } |
@@ -1126,7 +1196,9 @@ public class BSPrim : BSPhysObject | |||
1126 | } | 1196 | } |
1127 | else | 1197 | else |
1128 | { | 1198 | { |
1129 | ForcePosition = movePosition; | 1199 | _position = movePosition; |
1200 | PositionSanityCheck(true /* intaintTime */); | ||
1201 | ForcePosition = _position; | ||
1130 | } | 1202 | } |
1131 | DetailLog("{0},BSPrim.PIDTarget,move,fromPos={1},movePos={2}", LocalID, origPosition, movePosition); | 1203 | DetailLog("{0},BSPrim.PIDTarget,move,fromPos={1},movePos={2}", LocalID, origPosition, movePosition); |
1132 | }); | 1204 | }); |
@@ -1303,6 +1375,7 @@ public class BSPrim : BSPhysObject | |||
1303 | { | 1375 | { |
1304 | if (PhysBody.HasPhysicalBody) | 1376 | if (PhysBody.HasPhysicalBody) |
1305 | { | 1377 | { |
1378 | DetailLog("{0},BSPrim.AddAngularForce,taint,angForce={1}", LocalID, angForce); | ||
1306 | PhysicsScene.PE.ApplyTorque(PhysBody, angForce); | 1379 | PhysicsScene.PE.ApplyTorque(PhysBody, angForce); |
1307 | ActivateIfPhysical(false); | 1380 | ActivateIfPhysical(false); |
1308 | } | 1381 | } |
@@ -1667,7 +1740,7 @@ public class BSPrim : BSPhysObject | |||
1667 | // _velocity = entprop.Velocity; | 1740 | // _velocity = entprop.Velocity; |
1668 | // DEBUG DEBUG DEBUG -- smooth velocity changes a bit. The simulator seems to be | 1741 | // DEBUG DEBUG DEBUG -- smooth velocity changes a bit. The simulator seems to be |
1669 | // very sensitive to velocity changes. | 1742 | // very sensitive to velocity changes. |
1670 | if (!entprop.Velocity.ApproxEquals(_velocity, 0.1f)) | 1743 | if (entprop.Velocity == OMV.Vector3.Zero || !entprop.Velocity.ApproxEquals(_velocity, 0.1f)) |
1671 | _velocity = entprop.Velocity; | 1744 | _velocity = entprop.Velocity; |
1672 | _acceleration = entprop.Acceleration; | 1745 | _acceleration = entprop.Acceleration; |
1673 | _rotationalVelocity = entprop.RotationalVelocity; | 1746 | _rotationalVelocity = entprop.RotationalVelocity; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 05722b8..e6aefd5 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -161,7 +161,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
161 | private int m_physicsLoggingFileMinutes; | 161 | private int m_physicsLoggingFileMinutes; |
162 | private bool m_physicsLoggingDoFlush; | 162 | private bool m_physicsLoggingDoFlush; |
163 | private bool m_physicsPhysicalDumpEnabled; | 163 | private bool m_physicsPhysicalDumpEnabled; |
164 | public float PhysicsMetricDumpFrames { get; set; } | 164 | public int PhysicsMetricDumpFrames { get; set; } |
165 | // 'true' of the vehicle code is to log lots of details | 165 | // 'true' of the vehicle code is to log lots of details |
166 | public bool VehicleLoggingEnabled { get; private set; } | 166 | public bool VehicleLoggingEnabled { get; private set; } |
167 | public bool VehiclePhysicalLoggingEnabled { get; private set; } | 167 | public bool VehiclePhysicalLoggingEnabled { get; private set; } |
@@ -542,7 +542,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
542 | collidersCount = 0; | 542 | collidersCount = 0; |
543 | } | 543 | } |
544 | 544 | ||
545 | if ((m_simulationStep % PhysicsMetricDumpFrames) == 0) | 545 | if (PhysicsMetricDumpFrames != 0 && ((m_simulationStep % PhysicsMetricDumpFrames) == 0)) |
546 | PE.DumpPhysicsStatistics(World); | 546 | PE.DumpPhysicsStatistics(World); |
547 | 547 | ||
548 | // Get a value for 'now' so all the collision and update routines don't have to get their own. | 548 | // Get a value for 'now' so all the collision and update routines don't have to get their own. |
@@ -880,38 +880,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
880 | { | 880 | { |
881 | bool ret = false; | 881 | bool ret = false; |
882 | 882 | ||
883 | float valf = 0f; | 883 | BSParam.ParameterDefnBase theParam; |
884 | if (val.ToLower() == "true") | ||
885 | { | ||
886 | valf = PhysParameterEntry.NUMERIC_TRUE; | ||
887 | } | ||
888 | else | ||
889 | { | ||
890 | if (val.ToLower() == "false") | ||
891 | { | ||
892 | valf = PhysParameterEntry.NUMERIC_FALSE; | ||
893 | } | ||
894 | else | ||
895 | { | ||
896 | try | ||
897 | { | ||
898 | valf = float.Parse(val); | ||
899 | } | ||
900 | catch | ||
901 | { | ||
902 | valf = 0f; | ||
903 | } | ||
904 | } | ||
905 | } | ||
906 | |||
907 | BSParam.ParameterDefn theParam; | ||
908 | if (BSParam.TryGetParameter(parm, out theParam)) | 884 | if (BSParam.TryGetParameter(parm, out theParam)) |
909 | { | 885 | { |
910 | // Set the value in the C# code | 886 | // Set the value in the C# code |
911 | theParam.setter(this, parm, localID, valf); | 887 | theParam.SetValue(this, val); |
912 | 888 | ||
913 | // Optionally set the parameter in the unmanaged code | 889 | // Optionally set the parameter in the unmanaged code |
914 | if (theParam.onObject != null) | 890 | if (theParam.HasSetOnObject) |
915 | { | 891 | { |
916 | // update all the localIDs specified | 892 | // update all the localIDs specified |
917 | // If the local ID is APPLY_TO_NONE, just change the default value | 893 | // If the local ID is APPLY_TO_NONE, just change the default value |
@@ -923,16 +899,16 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
923 | case PhysParameterEntry.APPLY_TO_NONE: | 899 | case PhysParameterEntry.APPLY_TO_NONE: |
924 | // This will cause a call into the physical world if some operation is specified (SetOnObject). | 900 | // This will cause a call into the physical world if some operation is specified (SetOnObject). |
925 | objectIDs.Add(TERRAIN_ID); | 901 | objectIDs.Add(TERRAIN_ID); |
926 | TaintedUpdateParameter(parm, objectIDs, valf); | 902 | TaintedUpdateParameter(parm, objectIDs, val); |
927 | break; | 903 | break; |
928 | case PhysParameterEntry.APPLY_TO_ALL: | 904 | case PhysParameterEntry.APPLY_TO_ALL: |
929 | lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys); | 905 | lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys); |
930 | TaintedUpdateParameter(parm, objectIDs, valf); | 906 | TaintedUpdateParameter(parm, objectIDs, val); |
931 | break; | 907 | break; |
932 | default: | 908 | default: |
933 | // setting only one localID | 909 | // setting only one localID |
934 | objectIDs.Add(localID); | 910 | objectIDs.Add(localID); |
935 | TaintedUpdateParameter(parm, objectIDs, valf); | 911 | TaintedUpdateParameter(parm, objectIDs, val); |
936 | break; | 912 | break; |
937 | } | 913 | } |
938 | } | 914 | } |
@@ -943,22 +919,22 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
943 | } | 919 | } |
944 | 920 | ||
945 | // schedule the actual updating of the paramter to when the phys engine is not busy | 921 | // schedule the actual updating of the paramter to when the phys engine is not busy |
946 | private void TaintedUpdateParameter(string parm, List<uint> lIDs, float val) | 922 | private void TaintedUpdateParameter(string parm, List<uint> lIDs, string val) |
947 | { | 923 | { |
948 | float xval = val; | 924 | string xval = val; |
949 | List<uint> xlIDs = lIDs; | 925 | List<uint> xlIDs = lIDs; |
950 | string xparm = parm; | 926 | string xparm = parm; |
951 | TaintedObject("BSScene.UpdateParameterSet", delegate() { | 927 | TaintedObject("BSScene.UpdateParameterSet", delegate() { |
952 | BSParam.ParameterDefn thisParam; | 928 | BSParam.ParameterDefnBase thisParam; |
953 | if (BSParam.TryGetParameter(xparm, out thisParam)) | 929 | if (BSParam.TryGetParameter(xparm, out thisParam)) |
954 | { | 930 | { |
955 | if (thisParam.onObject != null) | 931 | if (thisParam.HasSetOnObject) |
956 | { | 932 | { |
957 | foreach (uint lID in xlIDs) | 933 | foreach (uint lID in xlIDs) |
958 | { | 934 | { |
959 | BSPhysObject theObject = null; | 935 | BSPhysObject theObject = null; |
960 | if (PhysObjects.TryGetValue(lID, out theObject)) | 936 | if (PhysObjects.TryGetValue(lID, out theObject)) |
961 | thisParam.onObject(this, theObject, xval); | 937 | thisParam.SetOnObject(this, theObject); |
962 | } | 938 | } |
963 | } | 939 | } |
964 | } | 940 | } |
@@ -971,10 +947,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
971 | { | 947 | { |
972 | string val = String.Empty; | 948 | string val = String.Empty; |
973 | bool ret = false; | 949 | bool ret = false; |
974 | BSParam.ParameterDefn theParam; | 950 | BSParam.ParameterDefnBase theParam; |
975 | if (BSParam.TryGetParameter(parm, out theParam)) | 951 | if (BSParam.TryGetParameter(parm, out theParam)) |
976 | { | 952 | { |
977 | val = theParam.getter(this).ToString(); | 953 | val = theParam.GetValue(this); |
978 | ret = true; | 954 | ret = true; |
979 | } | 955 | } |
980 | value = val; | 956 | value = val; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 096b300..2e54a93 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -568,7 +568,7 @@ public sealed class BSShapeCollection : IDisposable | |||
568 | { | 568 | { |
569 | 569 | ||
570 | newShape = PhysicsScene.PE.BuildCapsuleShape(PhysicsScene.World, 1f, 1f, prim.Scale); | 570 | newShape = PhysicsScene.PE.BuildCapsuleShape(PhysicsScene.World, 1f, 1f, prim.Scale); |
571 | if (DDetail) DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale); | 571 | if (DDetail) DetailLog("{0},BSShapeCollection.BuildPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale); |
572 | } | 572 | } |
573 | else | 573 | else |
574 | { | 574 | { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index bda7c47..49718c4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -1,17 +1,16 @@ | |||
1 | CURRENT PRIORITIES | 1 | CURRENT PRIORITIES |
2 | ================================================= | 2 | ================================================= |
3 | One sided meshes? Should terrain be built into a closed shape? | ||
4 | When meshes get partially wedged into the terrain, they cannot push themselves out. | ||
5 | It is possible that Bullet processes collisions whether entering or leaving a mesh. | ||
6 | Ref: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4869 | ||
7 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. | 3 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. |
8 | Not sure if it is because standing on it. Done with large prim linksets. | 4 | Not sure if it is because standing on it. Done with large prim linksets. |
9 | Terrain detail: double terrain mesh detail | ||
10 | Vehicle angular vertical attraction | 5 | Vehicle angular vertical attraction |
11 | vehicle angular banking | 6 | vehicle angular banking |
12 | Center-of-gravity | 7 | Center-of-gravity |
13 | Vehicle angular deflection | 8 | Vehicle angular deflection |
14 | Preferred orientation angular correction fix | 9 | Preferred orientation angular correction fix |
10 | Enable vehicle border crossings (at least as poorly as ODE) | ||
11 | Terrain skirts | ||
12 | Avatar created in previous region and not new region when crossing border | ||
13 | Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) | ||
15 | when should angular and linear motor targets be zeroed? when selected? | 14 | when should angular and linear motor targets be zeroed? when selected? |
16 | Need a vehicle.clear()? Or an 'else' in prestep if not physical. | 15 | Need a vehicle.clear()? Or an 'else' in prestep if not physical. |
17 | Teravus llMoveToTarget script debug | 16 | Teravus llMoveToTarget script debug |
@@ -26,14 +25,16 @@ Avatar movement | |||
26 | flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE) | 25 | flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE) |
27 | walking up stairs is not calibrated correctly (stairs out of Kepler cabin) | 26 | walking up stairs is not calibrated correctly (stairs out of Kepler cabin) |
28 | avatar capsule rotation completed (NOT DONE - Bullet's capsule shape is not the solution) | 27 | avatar capsule rotation completed (NOT DONE - Bullet's capsule shape is not the solution) |
29 | Enable vehicle border crossings (at least as poorly as ODE) | ||
30 | Terrain skirts | ||
31 | Avatar created in previous region and not new region when crossing border | ||
32 | Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) | ||
33 | Vehicle script tuning/debugging | 28 | Vehicle script tuning/debugging |
34 | Avanti speed script | 29 | Avanti speed script |
35 | Weapon shooter script | 30 | Weapon shooter script |
36 | Add material densities to the material types | 31 | Move material definitions (friction, ...) into simulator. |
32 | Add material densities to the material types. | ||
33 | Terrain detail: double terrain mesh detail | ||
34 | One sided meshes? Should terrain be built into a closed shape? | ||
35 | When meshes get partially wedged into the terrain, they cannot push themselves out. | ||
36 | It is possible that Bullet processes collisions whether entering or leaving a mesh. | ||
37 | Ref: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4869 | ||
37 | 38 | ||
38 | VEHICLES TODO LIST: | 39 | VEHICLES TODO LIST: |
39 | ================================================= | 40 | ================================================= |
@@ -65,6 +66,7 @@ Vehicle attributes are not restored when a vehicle is rezzed on region creation | |||
65 | 66 | ||
66 | GENERAL TODO LIST: | 67 | GENERAL TODO LIST: |
67 | ================================================= | 68 | ================================================= |
69 | Add a sanity check for PIDTarget location. | ||
68 | Level-of-detail for mesh creation. Prims with circular interiors require lod of 32. | 70 | Level-of-detail for mesh creation. Prims with circular interiors require lod of 32. |
69 | Is much saved with lower LODs? At the moment, all set to 32. | 71 | Is much saved with lower LODs? At the moment, all set to 32. |
70 | Collisions are inconsistant: arrows are supposed to hit and report collision. Often don't. | 72 | Collisions are inconsistant: arrows are supposed to hit and report collision. Often don't. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs b/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs index d240c71..02b03a8 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs | |||
@@ -30,4 +30,4 @@ using System.Runtime.InteropServices; | |||
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.7.6.*")] | 32 | [assembly: AssemblyVersion("0.7.6.*")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | |
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs b/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs index cafd7f4..f611b9a 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs | |||
@@ -33,4 +33,4 @@ using System.Runtime.InteropServices; | |||
33 | // by using the '*' as shown below: | 33 | // by using the '*' as shown below: |
34 | // [assembly: AssemblyVersion("1.0.*")] | 34 | // [assembly: AssemblyVersion("1.0.*")] |
35 | [assembly: AssemblyVersion("0.7.6.*")] | 35 | [assembly: AssemblyVersion("0.7.6.*")] |
36 | [assembly: AssemblyFileVersion("1.0.0.0")] | 36 | |
diff --git a/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs b/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs index bd70296..3de061a 100644 --- a/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs | |||
@@ -30,4 +30,4 @@ using System.Runtime.InteropServices; | |||
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.7.6.*")] | 32 | [assembly: AssemblyVersion("0.7.6.*")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | |