|
16 | 16 | * coincide in world space. Using local anchors and a local axis helps when saving and loading a
|
17 | 17 | * game.
|
18 | 18 | *
|
19 |
| - * @warning at least one body should by dynamic with a non-fixed rotation. |
20 |
| - * @author Daniel |
| 19 | + * Note: at least one body should by dynamic with a non-fixed rotation. |
21 | 20 | *
|
| 21 | + * @author Daniel |
22 | 22 | */
|
23 | 23 | public class PrismaticJointDef extends JointDef<PrismaticJoint> {
|
24 | 24 |
|
25 |
| - |
26 | 25 | /**
|
27 | 26 | * The local anchor point relative to body1's origin.
|
28 | 27 | */
|
29 |
| - public final Vec2 localAnchorA; |
| 28 | + public final Vec2 localAnchorA = new Vec2(); |
30 | 29 |
|
31 | 30 | /**
|
32 | 31 | * The local anchor point relative to body2's origin.
|
33 | 32 | */
|
34 |
| - public final Vec2 localAnchorB; |
| 33 | + public final Vec2 localAnchorB = new Vec2(); |
35 | 34 |
|
36 | 35 | /**
|
37 | 36 | * The local translation axis in body1.
|
38 | 37 | */
|
39 |
| - public final Vec2 localAxisA; |
| 38 | + public final Vec2 localAxisA = new Vec2(1.0f, 0.0f); |
40 | 39 |
|
41 | 40 | /**
|
42 | 41 | * The constrained angle between the bodies: body2_angle - body1_angle.
|
43 | 42 | */
|
44 |
| - public float referenceAngle; |
| 43 | + public float referenceAngle = 0.0f; |
45 | 44 |
|
46 | 45 | /**
|
47 | 46 | * Enable/disable the joint limit.
|
48 | 47 | */
|
49 |
| - public boolean enableLimit; |
| 48 | + public boolean enableLimit = false; |
50 | 49 |
|
51 | 50 | /**
|
52 | 51 | * The lower translation limit, usually in meters.
|
53 | 52 | */
|
54 |
| - public float lowerTranslation; |
| 53 | + public float lowerTranslation = 0.0f; |
55 | 54 |
|
56 | 55 | /**
|
57 | 56 | * The upper translation limit, usually in meters.
|
58 | 57 | */
|
59 |
| - public float upperTranslation; |
| 58 | + public float upperTranslation = 0.0f; |
60 | 59 |
|
61 | 60 | /**
|
62 | 61 | * Enable/disable the joint motor.
|
63 | 62 | */
|
64 |
| - public boolean enableMotor; |
| 63 | + public boolean enableMotor = false; |
65 | 64 |
|
66 | 65 | /**
|
67 | 66 | * The maximum motor torque, usually in N-m.
|
68 | 67 | */
|
69 |
| - public float maxMotorForce; |
| 68 | + public float maxMotorForce = 0.0f; |
70 | 69 |
|
71 | 70 | /**
|
72 | 71 | * The desired motor speed in radians per second.
|
73 | 72 | */
|
74 |
| - public float motorSpeed; |
75 |
| - |
76 |
| - public PrismaticJointDef() { |
77 |
| - localAnchorA = new Vec2(); |
78 |
| - localAnchorB = new Vec2(); |
79 |
| - localAxisA = new Vec2(1.0f, 0.0f); |
80 |
| - referenceAngle = 0.0f; |
81 |
| - enableLimit = false; |
82 |
| - lowerTranslation = 0.0f; |
83 |
| - upperTranslation = 0.0f; |
84 |
| - enableMotor = false; |
85 |
| - maxMotorForce = 0.0f; |
86 |
| - motorSpeed = 0.0f; |
87 |
| - } |
88 |
| - |
| 73 | + public float motorSpeed = 0.0f; |
89 | 74 |
|
90 | 75 | /**
|
91 | 76 | * Initialize the bodies, anchors, axis, and reference angle using the world anchor and world
|
|
0 commit comments