3535import org .spout .physics .math .Vector3 ;
3636
3737/**
38- * This class represents a ball-and-socket joint that allows arbitrary rotation between two bodies.
38+ * This class represents a ball-and-socket joint that allows arbitrary rotation between two bodies. This joint has three degrees of freedom. It can be used to create a chain of bodies for instance.
3939 */
4040public class BallAndSocketJoint extends Joint {
4141 private static final float BETA = 0.2f ;
@@ -76,24 +76,24 @@ public void initBeforeSolve(ConstraintSolverData constraintSolverData) {
7676 final Matrix3x3 skewSymmetricMatrixU1 = Matrix3x3 .computeSkewSymmetricMatrixForCrossProduct (mR1World );
7777 final Matrix3x3 skewSymmetricMatrixU2 = Matrix3x3 .computeSkewSymmetricMatrixForCrossProduct (mR2World );
7878 float inverseMassBodies = 0 ;
79- if (mBody1 .getIsMotionEnabled ()) {
79+ if (mBody1 .isMotionEnabled ()) {
8080 inverseMassBodies += mBody1 .getMassInverse ();
8181 }
82- if (mBody2 .getIsMotionEnabled ()) {
82+ if (mBody2 .isMotionEnabled ()) {
8383 inverseMassBodies += mBody2 .getMassInverse ();
8484 }
8585 final Matrix3x3 massMatrix = new Matrix3x3 (
8686 inverseMassBodies , 0 , 0 ,
8787 0 , inverseMassBodies , 0 ,
8888 0 , 0 , inverseMassBodies );
89- if (mBody1 .getIsMotionEnabled ()) {
89+ if (mBody1 .isMotionEnabled ()) {
9090 massMatrix .add (Matrix3x3 .multiply (skewSymmetricMatrixU1 , Matrix3x3 .multiply (mI1 , skewSymmetricMatrixU1 .getTranspose ())));
9191 }
92- if (mBody2 .getIsMotionEnabled ()) {
92+ if (mBody2 .isMotionEnabled ()) {
9393 massMatrix .add (Matrix3x3 .multiply (skewSymmetricMatrixU2 , Matrix3x3 .multiply (mI2 , skewSymmetricMatrixU2 .getTranspose ())));
9494 }
9595 mInverseMassMatrix .setToZero ();
96- if (mBody1 .getIsMotionEnabled () || mBody2 .getIsMotionEnabled ()) {
96+ if (mBody1 .isMotionEnabled () || mBody2 .isMotionEnabled ()) {
9797 mInverseMassMatrix .set (massMatrix .getInverse ());
9898 }
9999 mBiasVector .setToZero ();
@@ -114,13 +114,13 @@ public void warmstart(ConstraintSolverData constraintSolverData) {
114114 final Vector3 w2 = constraintSolverData .getAngularVelocities ()[mIndexBody2 ];
115115 final float inverseMassBody1 = mBody1 .getMassInverse ();
116116 final float inverseMassBody2 = mBody2 .getMassInverse ();
117- if (mBody1 .getIsMotionEnabled ()) {
117+ if (mBody1 .isMotionEnabled ()) {
118118 final Vector3 linearImpulseBody1 = Vector3 .negate (mImpulse );
119119 final Vector3 angularImpulseBody1 = mImpulse .cross (mR1World );
120120 v1 .add (Vector3 .multiply (inverseMassBody1 , linearImpulseBody1 ));
121121 w1 .add (Matrix3x3 .multiply (mI1 , angularImpulseBody1 ));
122122 }
123- if (mBody2 .getIsMotionEnabled ()) {
123+ if (mBody2 .isMotionEnabled ()) {
124124 final Vector3 linearImpulseBody2 = mImpulse ;
125125 final Vector3 angularImpulseBody2 = Vector3 .negate (mImpulse .cross (mR2World ));
126126 v2 .add (Vector3 .multiply (inverseMassBody2 , linearImpulseBody2 ));
@@ -139,13 +139,13 @@ public void solveVelocityConstraint(ConstraintSolverData constraintSolverData) {
139139 final Vector3 Jv = Vector3 .subtract (Vector3 .subtract (Vector3 .add (v2 , w2 .cross (mR2World )), v1 ), w1 .cross (mR1World ));
140140 final Vector3 deltaLambda = Matrix3x3 .multiply (mInverseMassMatrix , Vector3 .subtract (Vector3 .negate (Jv ), mBiasVector ));
141141 mImpulse .add (deltaLambda );
142- if (mBody1 .getIsMotionEnabled ()) {
142+ if (mBody1 .isMotionEnabled ()) {
143143 final Vector3 linearImpulseBody1 = Vector3 .negate (deltaLambda );
144144 final Vector3 angularImpulseBody1 = deltaLambda .cross (mR1World );
145145 v1 .add (Vector3 .multiply (inverseMassBody1 , linearImpulseBody1 ));
146146 w1 .add (Matrix3x3 .multiply (mI1 , angularImpulseBody1 ));
147147 }
148- if (mBody2 .getIsMotionEnabled ()) {
148+ if (mBody2 .isMotionEnabled ()) {
149149 final Vector3 linearImpulseBody2 = deltaLambda ;
150150 final Vector3 angularImpulseBody2 = Vector3 .negate (deltaLambda .cross (mR2World ));
151151 v2 .add (Vector3 .multiply (inverseMassBody2 , linearImpulseBody2 ));
@@ -171,29 +171,29 @@ public void solvePositionConstraint(ConstraintSolverData constraintSolverData) {
171171 final Matrix3x3 skewSymmetricMatrixU1 = Matrix3x3 .computeSkewSymmetricMatrixForCrossProduct (mR1World );
172172 final Matrix3x3 skewSymmetricMatrixU2 = Matrix3x3 .computeSkewSymmetricMatrixForCrossProduct (mR2World );
173173 float inverseMassBodies = 0 ;
174- if (mBody1 .getIsMotionEnabled ()) {
174+ if (mBody1 .isMotionEnabled ()) {
175175 inverseMassBodies += inverseMassBody1 ;
176176 }
177- if (mBody2 .getIsMotionEnabled ()) {
177+ if (mBody2 .isMotionEnabled ()) {
178178 inverseMassBodies += inverseMassBody2 ;
179179 }
180180 final Matrix3x3 massMatrix = new Matrix3x3 (
181181 inverseMassBodies , 0 , 0 ,
182182 0 , inverseMassBodies , 0 ,
183183 0 , 0 , inverseMassBodies );
184- if (mBody1 .getIsMotionEnabled ()) {
184+ if (mBody1 .isMotionEnabled ()) {
185185 massMatrix .add (Matrix3x3 .multiply (skewSymmetricMatrixU1 , Matrix3x3 .multiply (mI1 , skewSymmetricMatrixU1 .getTranspose ())));
186186 }
187- if (mBody2 .getIsMotionEnabled ()) {
187+ if (mBody2 .isMotionEnabled ()) {
188188 massMatrix .add (Matrix3x3 .multiply (skewSymmetricMatrixU2 , Matrix3x3 .multiply (mI2 , skewSymmetricMatrixU2 .getTranspose ())));
189189 }
190190 mInverseMassMatrix .setToZero ();
191- if (mBody1 .getIsMotionEnabled () || mBody2 .getIsMotionEnabled ()) {
191+ if (mBody1 .isMotionEnabled () || mBody2 .isMotionEnabled ()) {
192192 mInverseMassMatrix .set (massMatrix .getInverse ());
193193 }
194194 final Vector3 constraintError = Vector3 .subtract (Vector3 .subtract (Vector3 .add (x2 , mR2World ), x1 ), mR1World );
195195 final Vector3 lambda = Matrix3x3 .multiply (mInverseMassMatrix , Vector3 .negate (constraintError ));
196- if (mBody1 .getIsMotionEnabled ()) {
196+ if (mBody1 .isMotionEnabled ()) {
197197 final Vector3 linearImpulseBody1 = Vector3 .negate (lambda );
198198 final Vector3 angularImpulseBody1 = lambda .cross (mR1World );
199199 final Vector3 v1 = Vector3 .multiply (inverseMassBody1 , linearImpulseBody1 );
@@ -202,7 +202,7 @@ public void solvePositionConstraint(ConstraintSolverData constraintSolverData) {
202202 q1 .add (Quaternion .multiply (Quaternion .multiply (new Quaternion (0 , w1 ), q1 ), 0.5f ));
203203 q1 .normalize ();
204204 }
205- if (mBody2 .getIsMotionEnabled ()) {
205+ if (mBody2 .isMotionEnabled ()) {
206206 final Vector3 linearImpulseBody2 = lambda ;
207207 final Vector3 angularImpulseBody2 = Vector3 .negate (lambda .cross (mR2World ));
208208 final Vector3 v2 = Vector3 .multiply (inverseMassBody2 , linearImpulseBody2 );
0 commit comments