private void drawJoint(Joint joint) { Body bodyA = joint.getBodyA(); Body bodyB = joint.getBodyB(); Transform xf1 = bodyA.getTransform(); Transform xf2 = bodyB.getTransform(); Vec2 p1 = pool.popVec2(); Vec2 p2 = pool.popVec2(); joint.getAnchorA(p1); joint.getAnchorB(p2); switch (joint.getType()) {
boolean collideConnected = j.getCollideConnected(); Body bodyA = j.getBodyA(); Body bodyB = j.getBodyB(); j.m_edgeB.next = null; Joint.destroy(j);
Joint j = Joint.create(this, def); j.m_edgeA.other = j.getBodyB(); j.m_edgeA.prev = null; j.m_edgeA.next = j.getBodyA().m_jointList; if (j.getBodyA().m_jointList != null) { j.getBodyA().m_jointList.prev = j.m_edgeA; j.getBodyA().m_jointList = j.m_edgeA; j.m_edgeB.other = j.getBodyA(); j.m_edgeB.prev = null; j.m_edgeB.next = j.getBodyB().m_jointList; if (j.getBodyB().m_jointList != null) { j.getBodyB().m_jointList.prev = j.m_edgeB; j.getBodyB().m_jointList = j.m_edgeB;
Body bA = joint.getBodyA(); Body bB = joint.getBodyB(); builder.setCollideConnected(joint.getCollideConnected()); switch (joint.getType()) { case REVOLUTE: { RevoluteJoint j = (RevoluteJoint) joint; + joint.getType(), Type.JOINT); if (listener == null || listener.isUnsupported(e)) { throw e;
public boolean getCollideConnected () { return joint.getCollideConnected(); }
public static void destroy(Joint joint) { joint.destructor(); }
for (Joint j = m_jointList; j != null; j = j.getNext()) { drawJoint(j);
/** Get the type of the concrete joint. */ public JointType getType () { org.jbox2d.dynamics.joints.JointType type2 = joint.getType(); if (type2 == org.jbox2d.dynamics.joints.JointType.DISTANCE) return JointType.DistanceJoint; if (type2 == org.jbox2d.dynamics.joints.JointType.FRICTION) return JointType.FrictionJoint; if (type2 == org.jbox2d.dynamics.joints.JointType.GEAR) return JointType.GearJoint; if (type2 == org.jbox2d.dynamics.joints.JointType.MOUSE) return JointType.MouseJoint; if (type2 == org.jbox2d.dynamics.joints.JointType.PRISMATIC) return JointType.PrismaticJoint; if (type2 == org.jbox2d.dynamics.joints.JointType.PULLEY) return JointType.PulleyJoint; if (type2 == org.jbox2d.dynamics.joints.JointType.REVOLUTE) return JointType.RevoluteJoint; if (type2 == org.jbox2d.dynamics.joints.JointType.ROPE) return JointType.RopeJoint; if (type2 == org.jbox2d.dynamics.joints.JointType.UNKNOWN) return JointType.Unknown; if (type2 == org.jbox2d.dynamics.joints.JointType.WELD) return JointType.WeldJoint; if (type2 == org.jbox2d.dynamics.joints.JointType.WHEEL) return JointType.WheelJoint; return JointType.Unknown; }
/** Get the first body attached to this joint. */ public Body getBodyA () { return world.bodies.get(joint.getBodyA()); }
/** Get the second body attached to this joint. */ public Body getBodyB () { return world.bodies.get(joint.getBodyB()); }
public Vector2 getAnchorA () { joint.getAnchorA(tmp); return anchorA.set(tmp.x, tmp.y); }
public Vector2 getAnchorB () { joint.getAnchorB(tmp); return anchorB.set(tmp.x, tmp.y); }
/** * This is used to prevent connected bodies from colliding. It may lie, depending on the * collideConnected flag. * * @param other * @return */ public boolean shouldCollide(Body other) { // At least one body should be dynamic. if (m_type != BodyType.DYNAMIC && other.m_type != BodyType.DYNAMIC) { return false; } // Does a joint prevent collision? for (JointEdge jn = m_jointList; jn != null; jn = jn.next) { if (jn.other == other) { if (jn.joint.getCollideConnected() == false) { return false; } } } return true; }
public static void destroy(Joint joint) { joint.destructor(); }
for (Joint j = m_jointList; j != null; j = j.getNext()) { drawJoint(j);
private void drawJoint(Joint joint) { Body bodyA = joint.getBodyA(); Body bodyB = joint.getBodyB(); Transform xf1 = bodyA.getTransform(); Transform xf2 = bodyB.getTransform(); Vec2 p1 = pool.popVec2(); Vec2 p2 = pool.popVec2(); joint.getAnchorA(p1); joint.getAnchorB(p2); switch (joint.getType()) {
boolean collideConnected = j.getCollideConnected(); Body bodyA = j.getBodyA(); Body bodyB = j.getBodyB(); j.m_edgeB.next = null; Joint.destroy(j);