diff options
author | Robert Adams | 2012-12-30 10:21:47 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-31 19:57:22 -0800 |
commit | 9218748321519ed04da5cdffa1f29e69030171b5 (patch) | |
tree | 7516cfbea32d716651430bc3124dbdd4cb772105 /OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs | |
parent | BulletSim: add the implementation files for the two versions of Bullet: (diff) | |
download | opensim-SC_OLD-9218748321519ed04da5cdffa1f29e69030171b5.zip opensim-SC_OLD-9218748321519ed04da5cdffa1f29e69030171b5.tar.gz opensim-SC_OLD-9218748321519ed04da5cdffa1f29e69030171b5.tar.bz2 opensim-SC_OLD-9218748321519ed04da5cdffa1f29e69030171b5.tar.xz |
BulletSim: another round of conversion: dynamics world and collision object functions.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs index b946870..aee93c9 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs | |||
@@ -43,15 +43,14 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
43 | Vector3 frame1, Quaternion frame1rot, | 43 | Vector3 frame1, Quaternion frame1rot, |
44 | Vector3 frame2, Quaternion frame2rot, | 44 | Vector3 frame2, Quaternion frame2rot, |
45 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | 45 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) |
46 | : base(world) | ||
46 | { | 47 | { |
47 | m_world = world; | ||
48 | m_body1 = obj1; | 48 | m_body1 = obj1; |
49 | m_body2 = obj2; | 49 | m_body2 = obj2; |
50 | m_constraint = new BulletConstraint( | 50 | m_constraint = PhysicsScene.PE.Create6DofConstraint(m_world, m_body1, m_body2, |
51 | BulletSimAPI.Create6DofConstraint2(m_world.ptr, m_body1.ptr, m_body2.ptr, | ||
52 | frame1, frame1rot, | 51 | frame1, frame1rot, |
53 | frame2, frame2rot, | 52 | frame2, frame2rot, |
54 | useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | 53 | useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); |
55 | m_enabled = true; | 54 | m_enabled = true; |
56 | world.physicsScene.DetailLog("{0},BS6DofConstraint,createFrame,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}", | 55 | world.physicsScene.DetailLog("{0},BS6DofConstraint,createFrame,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}", |
57 | BSScene.DetailLogZero, world.worldID, | 56 | BSScene.DetailLogZero, world.worldID, |
@@ -61,8 +60,8 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
61 | public BSConstraint6Dof(BulletWorld world, BulletBody obj1, BulletBody obj2, | 60 | public BSConstraint6Dof(BulletWorld world, BulletBody obj1, BulletBody obj2, |
62 | Vector3 joinPoint, | 61 | Vector3 joinPoint, |
63 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | 62 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) |
63 | : base(world) | ||
64 | { | 64 | { |
65 | m_world = world; | ||
66 | m_body1 = obj1; | 65 | m_body1 = obj1; |
67 | m_body2 = obj2; | 66 | m_body2 = obj2; |
68 | if (!obj1.HasPhysicalBody || !obj2.HasPhysicalBody) | 67 | if (!obj1.HasPhysicalBody || !obj2.HasPhysicalBody) |
@@ -76,11 +75,10 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
76 | } | 75 | } |
77 | else | 76 | else |
78 | { | 77 | { |
79 | m_constraint = new BulletConstraint( | 78 | m_constraint = PhysicsScene.PE.Create6DofConstraintToPoint(m_world, m_body1, m_body2, |
80 | BulletSimAPI.Create6DofConstraintToPoint2(m_world.ptr, m_body1.ptr, m_body2.ptr, | ||
81 | joinPoint, | 79 | joinPoint, |
82 | useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); | 80 | useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); |
83 | world.physicsScene.DetailLog("{0},BS6DofConstraint,createMidPoint,wID={1}, csrt={2}, rID={3}, rBody={4}, cID={5}, cBody={6}", | 81 | PhysicsScene.DetailLog("{0},BS6DofConstraint,createMidPoint,wID={1}, csrt={2}, rID={3}, rBody={4}, cID={5}, cBody={6}", |
84 | BSScene.DetailLogZero, world.worldID, m_constraint.ptr.ToString("X"), | 82 | BSScene.DetailLogZero, world.worldID, m_constraint.ptr.ToString("X"), |
85 | obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X")); | 83 | obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X")); |
86 | if (!m_constraint.HasPhysicalConstraint) | 84 | if (!m_constraint.HasPhysicalConstraint) |
@@ -101,7 +99,7 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
101 | bool ret = false; | 99 | bool ret = false; |
102 | if (m_enabled) | 100 | if (m_enabled) |
103 | { | 101 | { |
104 | BulletSimAPI.SetFrames2(m_constraint.ptr, frameA, frameArot, frameB, frameBrot); | 102 | PhysicsScene.PE.SetFrames(m_constraint, frameA, frameArot, frameB, frameBrot); |
105 | ret = true; | 103 | ret = true; |
106 | } | 104 | } |
107 | return ret; | 105 | return ret; |
@@ -112,9 +110,9 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
112 | bool ret = false; | 110 | bool ret = false; |
113 | if (m_enabled) | 111 | if (m_enabled) |
114 | { | 112 | { |
115 | BulletSimAPI.SetConstraintParam2(m_constraint.ptr, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL); | 113 | PhysicsScene.PE.SetConstraintParam(m_constraint, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL); |
116 | BulletSimAPI.SetConstraintParam2(m_constraint.ptr, ConstraintParams.BT_CONSTRAINT_STOP_ERP, erp, ConstraintParamAxis.AXIS_ALL); | 114 | PhysicsScene.PE.SetConstraintParam(m_constraint, ConstraintParams.BT_CONSTRAINT_STOP_ERP, erp, ConstraintParamAxis.AXIS_ALL); |
117 | BulletSimAPI.SetConstraintParam2(m_constraint.ptr, ConstraintParams.BT_CONSTRAINT_CFM, cfm, ConstraintParamAxis.AXIS_ALL); | 115 | PhysicsScene.PE.SetConstraintParam(m_constraint, ConstraintParams.BT_CONSTRAINT_CFM, cfm, ConstraintParamAxis.AXIS_ALL); |
118 | ret = true; | 116 | ret = true; |
119 | } | 117 | } |
120 | return ret; | 118 | return ret; |
@@ -125,7 +123,7 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
125 | bool ret = false; | 123 | bool ret = false; |
126 | float onOff = useOffset ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse; | 124 | float onOff = useOffset ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse; |
127 | if (m_enabled) | 125 | if (m_enabled) |
128 | ret = BulletSimAPI.UseFrameOffset2(m_constraint.ptr, onOff); | 126 | ret = PhysicsScene.PE.UseFrameOffset(m_constraint, onOff); |
129 | return ret; | 127 | return ret; |
130 | } | 128 | } |
131 | 129 | ||
@@ -135,7 +133,7 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
135 | float onOff = enable ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse; | 133 | float onOff = enable ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse; |
136 | if (m_enabled) | 134 | if (m_enabled) |
137 | { | 135 | { |
138 | ret = BulletSimAPI.TranslationalLimitMotor2(m_constraint.ptr, onOff, targetVelocity, maxMotorForce); | 136 | ret = PhysicsScene.PE.TranslationalLimitMotor(m_constraint, onOff, targetVelocity, maxMotorForce); |
139 | m_world.physicsScene.DetailLog("{0},BS6DOFConstraint,TransLimitMotor,enable={1},vel={2},maxForce={3}", | 137 | m_world.physicsScene.DetailLog("{0},BS6DOFConstraint,TransLimitMotor,enable={1},vel={2},maxForce={3}", |
140 | BSScene.DetailLogZero, enable, targetVelocity, maxMotorForce); | 138 | BSScene.DetailLogZero, enable, targetVelocity, maxMotorForce); |
141 | } | 139 | } |
@@ -146,7 +144,7 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
146 | { | 144 | { |
147 | bool ret = false; | 145 | bool ret = false; |
148 | if (m_enabled) | 146 | if (m_enabled) |
149 | ret = BulletSimAPI.SetBreakingImpulseThreshold2(m_constraint.ptr, threshold); | 147 | ret = PhysicsScene.PE.SetBreakingImpulseThreshold(m_constraint, threshold); |
150 | return ret; | 148 | return ret; |
151 | } | 149 | } |
152 | } | 150 | } |