aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BS6DofConstraint.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BS6DofConstraint.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BS6DofConstraint.cs50
1 files changed, 44 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BS6DofConstraint.cs b/OpenSim/Region/Physics/BulletSPlugin/BS6DofConstraint.cs
index 72df6b9..683bc51 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BS6DofConstraint.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BS6DofConstraint.cs
@@ -37,7 +37,8 @@ public class BS6DofConstraint : BSConstraint
37 // Create a btGeneric6DofConstraint 37 // Create a btGeneric6DofConstraint
38 public BS6DofConstraint(BulletSim world, BulletBody obj1, BulletBody obj2, 38 public BS6DofConstraint(BulletSim world, BulletBody obj1, BulletBody obj2,
39 Vector3 frame1, Quaternion frame1rot, 39 Vector3 frame1, Quaternion frame1rot,
40 Vector3 frame2, Quaternion frame2rot ) 40 Vector3 frame2, Quaternion frame2rot,
41 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
41 { 42 {
42 m_world = world; 43 m_world = world;
43 m_body1 = obj1; 44 m_body1 = obj1;
@@ -46,16 +47,45 @@ public class BS6DofConstraint : BSConstraint
46 BulletSimAPI.Create6DofConstraint2(m_world.Ptr, m_body1.Ptr, m_body2.Ptr, 47 BulletSimAPI.Create6DofConstraint2(m_world.Ptr, m_body1.Ptr, m_body2.Ptr,
47 frame1, frame1rot, 48 frame1, frame1rot,
48 frame2, frame2rot, 49 frame2, frame2rot,
49 true /*useLinearReferenceFrameA*/, true /*disableCollisionsBetweenLinkedBodies*/)); 50 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
50 m_enabled = true; 51 m_enabled = true;
51 } 52 }
52 53
54 public BS6DofConstraint(BulletSim world, BulletBody obj1, BulletBody obj2,
55 Vector3 joinPoint,
56 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
57 {
58 m_world = world;
59 m_body1 = obj1;
60 m_body2 = obj2;
61 m_constraint = new BulletConstraint(
62 BulletSimAPI.Create6DofConstraintToPoint2(m_world.Ptr, m_body1.Ptr, m_body2.Ptr,
63 joinPoint,
64 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
65 m_enabled = true;
66 }
67
68 public bool SetFrames(Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot)
69 {
70 bool ret = false;
71 if (m_enabled)
72 {
73 BulletSimAPI.SetFrames2(m_constraint.Ptr, frameA, frameArot, frameB, frameBrot);
74 ret = true;
75 }
76 return ret;
77 }
78
53 public bool SetCFMAndERP(float cfm, float erp) 79 public bool SetCFMAndERP(float cfm, float erp)
54 { 80 {
55 bool ret = true; 81 bool ret = false;
56 BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL); 82 if (m_enabled)
57 BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_ERP, erp, ConstraintParamAxis.AXIS_ALL); 83 {
58 BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_CFM, cfm, ConstraintParamAxis.AXIS_ALL); 84 BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL);
85 BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_ERP, erp, ConstraintParamAxis.AXIS_ALL);
86 BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_CFM, cfm, ConstraintParamAxis.AXIS_ALL);
87 ret = true;
88 }
59 return ret; 89 return ret;
60 } 90 }
61 91
@@ -76,5 +106,13 @@ public class BS6DofConstraint : BSConstraint
76 ret = BulletSimAPI.TranslationalLimitMotor2(m_constraint.Ptr, onOff, targetVelocity, maxMotorForce); 106 ret = BulletSimAPI.TranslationalLimitMotor2(m_constraint.Ptr, onOff, targetVelocity, maxMotorForce);
77 return ret; 107 return ret;
78 } 108 }
109
110 public bool SetBreakingImpulseThreshold(float threshold)
111 {
112 bool ret = false;
113 if (m_enabled)
114 ret = BulletSimAPI.SetBreakingImpulseThreshold2(m_constraint.Ptr, threshold);
115 return ret;
116 }
79} 117}
80} 118}