39
39
*/
40
40
public class WheelJoint extends Joint {
41
41
42
- private float m_frequencyHz ;
43
- private float m_dampingRatio ;
44
-
45
42
// Solver shared
46
43
private final Vec2 m_localAnchorA = new Vec2 ();
47
44
private final Vec2 m_localAnchorB = new Vec2 ();
48
45
private final Vec2 m_localXAxisA = new Vec2 ();
49
46
private final Vec2 m_localYAxisA = new Vec2 ();
50
47
51
48
private float m_impulse ;
52
- private float m_motorImpulse ;
49
+ private float m_motorImpulse = 0.0f ;
53
50
private float m_springImpulse ;
54
51
55
52
private float m_maxMotorTorque ;
56
53
private float m_motorSpeed ;
57
54
private boolean m_enableMotor ;
55
+ private float m_frequencyHz ;
56
+ private float m_dampingRatio ;
58
57
59
58
// Solver temp
60
59
private int m_indexA ;
@@ -68,11 +67,13 @@ public class WheelJoint extends Joint {
68
67
69
68
private final Vec2 m_ax = new Vec2 ();
70
69
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 ;
73
74
74
75
private float m_mass ;
75
- private float m_motorMass ;
76
+ private float m_motorMass = 0.0f ;
76
77
private float m_springMass ;
77
78
78
79
private float m_bias ;
@@ -85,14 +86,9 @@ protected WheelJoint(IWorldPool argPool, WheelJointDef def) {
85
86
m_localXAxisA .set (def .localAxisA );
86
87
Vec2 .crossToOutUnsafe (1.0f , m_localXAxisA , m_localYAxisA );
87
88
88
-
89
- m_motorMass = 0.0f ;
90
- m_motorImpulse = 0.0f ;
91
-
92
89
m_maxMotorTorque = def .maxMotorTorque ;
93
90
m_motorSpeed = def .motorSpeed ;
94
91
m_enableMotor = def .enableMotor ;
95
-
96
92
m_frequencyHz = def .frequencyHz ;
97
93
m_dampingRatio = def .dampingRatio ;
98
94
}
@@ -340,9 +336,7 @@ public void initVelocityConstraints(SolverData data) {
340
336
pool .pushRot (2 );
341
337
pool .pushVec2 (1 );
342
338
343
- // data.velocities[m_indexA].v = vA;
344
339
data .velocities [m_indexA ].w = wA ;
345
- // data.velocities[m_indexB].v = vB;
346
340
data .velocities [m_indexB ].w = wB ;
347
341
}
348
342
@@ -414,9 +408,7 @@ public void solveVelocityConstraints(SolverData data) {
414
408
}
415
409
pool .pushVec2 (2 );
416
410
417
- // data.velocities[m_indexA].v = vA;
418
411
data .velocities [m_indexA ].w = wA ;
419
- // data.velocities[m_indexB].v = vB;
420
412
data .velocities [m_indexB ].w = wB ;
421
413
}
422
414
@@ -470,9 +462,7 @@ public boolean solvePositionConstraints(SolverData data) {
470
462
471
463
pool .pushVec2 (3 );
472
464
pool .pushRot (2 );
473
- // data.positions[m_indexA].c = cA;
474
465
data .positions [m_indexA ].a = aA ;
475
- // data.positions[m_indexB].c = cB;
476
466
data .positions [m_indexB ].a = aB ;
477
467
478
468
return FXGLMath .abs (C ) <= JBoxSettings .linearSlop ;
0 commit comments