Skip to content

Commit

Permalink
refactor: clean up weld joint
Browse files Browse the repository at this point in the history
  • Loading branch information
AlmasB committed Jan 3, 2024
1 parent b709aea commit f2c44d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,7 @@ public void initVelocityConstraints(final SolverData data) {
m_impulse.setZero();
}

// data.velocities[m_indexA].v.set(vA);
data.velocities[m_indexA].w = wA;
// data.velocities[m_indexB].v.set(vB);
data.velocities[m_indexB].w = wB;

pool.pushVec2(1);
Expand Down Expand Up @@ -308,9 +306,7 @@ public void solveVelocityConstraints(final SolverData data) {
pool.pushVec3(2);
}

// data.velocities[m_indexA].v.set(vA);
data.velocities[m_indexA].w = wA;
// data.velocities[m_indexB].v.set(vB);
data.velocities[m_indexB].w = wB;

pool.pushVec2(3);
Expand Down Expand Up @@ -392,9 +388,7 @@ public boolean solvePositionConstraints(final SolverData data) {
pool.pushVec3(2);
}

// data.positions[m_indexA].c.set(cA);
data.positions[m_indexA].a = aA;
// data.positions[m_indexB].c.set(cB);
data.positions[m_indexB].a = aB;

pool.pushVec2(5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,37 @@
import com.almasb.fxgl.physics.box2d.dynamics.Body;
import com.almasb.fxgl.physics.box2d.dynamics.World;

/**
* Created at 3:38:52 AM Jan 15, 2011
*/

/**
* @author Daniel Murphy
*/
public class WeldJointDef extends JointDef<WeldJoint> {
/**
* The local anchor point relative to body1's origin.
*/
public final Vec2 localAnchorA;
public final Vec2 localAnchorA = new Vec2();

/**
* The local anchor point relative to body2's origin.
*/
public final Vec2 localAnchorB;
public final Vec2 localAnchorB = new Vec2();

/**
* The body2 angle minus body1 angle in the reference state (radians).
*/
public float referenceAngle;
public float referenceAngle = 0f;

/**
* The mass-spring-damper frequency in Hertz. Rotation only. Disable softness with a value of 0.
*/
public float frequencyHz;
public float frequencyHz = 0f;

/**
* The damping ratio. 0 = no damping, 1 = critical damping.
*/
public float dampingRatio;

public WeldJointDef() {
localAnchorA = new Vec2();
localAnchorB = new Vec2();
referenceAngle = 0.0f;
}
public float dampingRatio = 0f;

/**
* Initialize the bodies, anchors, and reference angle using a world anchor point.
*
* @param bA
* @param bB
* @param anchor
*/
public void initialize(Body bA, Body bB, Vec2 anchor) {
setBodyA(bA);
Expand Down

0 comments on commit f2c44d9

Please sign in to comment.