3939 */
4040public class WheelJoint extends Joint {
4141
42- private float m_frequencyHz ;
43- private float m_dampingRatio ;
44-
4542 // Solver shared
4643 private final Vec2 m_localAnchorA = new Vec2 ();
4744 private final Vec2 m_localAnchorB = new Vec2 ();
4845 private final Vec2 m_localXAxisA = new Vec2 ();
4946 private final Vec2 m_localYAxisA = new Vec2 ();
5047
5148 private float m_impulse ;
52- private float m_motorImpulse ;
49+ private float m_motorImpulse = 0.0f ;
5350 private float m_springImpulse ;
5451
5552 private float m_maxMotorTorque ;
5653 private float m_motorSpeed ;
5754 private boolean m_enableMotor ;
55+ private float m_frequencyHz ;
56+ private float m_dampingRatio ;
5857
5958 // Solver temp
6059 private int m_indexA ;
@@ -68,11 +67,13 @@ public class WheelJoint extends Joint {
6867
6968 private final Vec2 m_ax = new Vec2 ();
7069 private final Vec2 m_ay = new Vec2 ();
71- private float m_sAx , m_sBx ;
72- private float m_sAy , m_sBy ;
70+ private float m_sAx ;
71+ private float m_sBx ;
72+ private float m_sAy ;
73+ private float m_sBy ;
7374
7475 private float m_mass ;
75- private float m_motorMass ;
76+ private float m_motorMass = 0.0f ;
7677 private float m_springMass ;
7778
7879 private float m_bias ;
@@ -85,14 +86,9 @@ protected WheelJoint(IWorldPool argPool, WheelJointDef def) {
8586 m_localXAxisA .set (def .localAxisA );
8687 Vec2 .crossToOutUnsafe (1.0f , m_localXAxisA , m_localYAxisA );
8788
88-
89- m_motorMass = 0.0f ;
90- m_motorImpulse = 0.0f ;
91-
9289 m_maxMotorTorque = def .maxMotorTorque ;
9390 m_motorSpeed = def .motorSpeed ;
9491 m_enableMotor = def .enableMotor ;
95-
9692 m_frequencyHz = def .frequencyHz ;
9793 m_dampingRatio = def .dampingRatio ;
9894 }
@@ -340,9 +336,7 @@ public void initVelocityConstraints(SolverData data) {
340336 pool .pushRot (2 );
341337 pool .pushVec2 (1 );
342338
343- // data.velocities[m_indexA].v = vA;
344339 data .velocities [m_indexA ].w = wA ;
345- // data.velocities[m_indexB].v = vB;
346340 data .velocities [m_indexB ].w = wB ;
347341 }
348342
@@ -414,9 +408,7 @@ public void solveVelocityConstraints(SolverData data) {
414408 }
415409 pool .pushVec2 (2 );
416410
417- // data.velocities[m_indexA].v = vA;
418411 data .velocities [m_indexA ].w = wA ;
419- // data.velocities[m_indexB].v = vB;
420412 data .velocities [m_indexB ].w = wB ;
421413 }
422414
@@ -470,9 +462,7 @@ public boolean solvePositionConstraints(SolverData data) {
470462
471463 pool .pushVec2 (3 );
472464 pool .pushRot (2 );
473- // data.positions[m_indexA].c = cA;
474465 data .positions [m_indexA ].a = aA ;
475- // data.positions[m_indexB].c = cB;
476466 data .positions [m_indexB ].a = aB ;
477467
478468 return FXGLMath .abs (C ) <= JBoxSettings .linearSlop ;
0 commit comments