A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/AlmasB/FXGL/commit/3815f522e below:

clean up wheel joint · AlmasB/FXGL@3815f52 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+14

-31

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+14

-31

lines changed Original file line number Diff line number Diff line change

@@ -39,22 +39,21 @@

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;

Original file line number Diff line number Diff line change

@@ -36,39 +36,32 @@ public class WheelJointDef extends JointDef<WheelJoint> {

36 36

/**

37 37

* The local translation axis in body1.

38 38

*/

39 -

public final Vec2 localAxisA = new Vec2();

39 +

public final Vec2 localAxisA = new Vec2(1, 0);

40 40 41 41

/**

42 42

* Enable/disable the joint motor.

43 43

*/

44 -

public boolean enableMotor;

44 +

public boolean enableMotor = false;

45 45 46 46

/**

47 47

* The maximum motor torque, usually in N-m.

48 48

*/

49 -

public float maxMotorTorque;

49 +

public float maxMotorTorque = 0f;

50 50 51 51

/**

52 52

* The desired motor speed in radians per second.

53 53

*/

54 -

public float motorSpeed;

54 +

public float motorSpeed = 0f;

55 55 56 56

/**

57 57

* Suspension frequency, zero indicates no suspension

58 58

*/

59 -

public float frequencyHz;

59 +

public float frequencyHz = 0f;

60 60 61 61

/**

62 62

* Suspension damping ratio, one indicates critical damping

63 63

*/

64 -

public float dampingRatio;

65 - 66 -

public WheelJointDef() {

67 -

localAxisA.set(1, 0);

68 -

enableMotor = false;

69 -

maxMotorTorque = 0f;

70 -

motorSpeed = 0f;

71 -

}

64 +

public float dampingRatio = 0f;

72 65 73 66

public void initialize(Body b1, Body b2, Vec2 anchor, Vec2 axis) {

74 67

setBodyA(b1);

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4