List of usage examples for com.badlogic.gdx.physics.box2d.joints PulleyJoint getGroundAnchorB
public Vector2 getGroundAnchorB()
From source file:com.altportalgames.colorrain.utils.Box2DDebugRenderer.java
License:Apache License
private void drawJoint(Joint joint) { Body bodyA = joint.getBodyA();/* w w w. j a v a 2 s. c o m*/ Body bodyB = joint.getBodyB(); Transform xf1 = bodyA.getTransform(); Transform xf2 = bodyB.getTransform(); Vector2 x1 = xf1.getPosition(); Vector2 x2 = xf2.getPosition(); Vector2 p1 = joint.getAnchorA(); Vector2 p2 = joint.getAnchorB(); if (joint.getType() == JointType.DistanceJoint) { drawSegment(p1, p2, JOINT_COLOR); } else if (joint.getType() == JointType.PulleyJoint) { PulleyJoint pulley = (PulleyJoint) joint; Vector2 s1 = pulley.getGroundAnchorA(); Vector2 s2 = pulley.getGroundAnchorB(); drawSegment(s1, p1, JOINT_COLOR); drawSegment(s2, p2, JOINT_COLOR); drawSegment(s1, s2, JOINT_COLOR); } else if (joint.getType() == JointType.MouseJoint) { } else { drawSegment(x1, p1, JOINT_COLOR); drawSegment(p1, p2, JOINT_COLOR); drawSegment(x2, p2, JOINT_COLOR); } }
From source file:com.blindtigergames.werescrewed.debug.SBox2DDebugRenderer.java
License:Apache License
private void drawJoint(Joint joint) { Body bodyA = joint.getBodyA();//from w w w . jav a 2s . c om Body bodyB = joint.getBodyB(); Transform xf1 = bodyA.getTransform(); Transform xf2 = bodyB.getTransform(); Vector2 x1 = xf1.getPosition(); Vector2 x2 = xf2.getPosition(); Vector2 p1 = joint.getAnchorA(); Vector2 p2 = joint.getAnchorB(); if (joint.getType() == JointType.DistanceJoint) { drawSegment(p1, p2, JOINT_COLOR); } else if (joint.getType() == JointType.PulleyJoint) { PulleyJoint pulley = (PulleyJoint) joint; Vector2 s1 = pulley.getGroundAnchorA(); Vector2 s2 = pulley.getGroundAnchorB(); drawSegment(s1, p1, JOINT_COLOR); drawSegment(s2, p2, JOINT_COLOR); drawSegment(s1, s2, JOINT_COLOR); } else if (joint.getType() == JointType.MouseJoint) { drawSegment(joint.getAnchorA(), joint.getAnchorB(), JOINT_COLOR); } else { drawSegment(x1, p1, JOINT_COLOR); drawSegment(p1, p2, JOINT_COLOR); drawSegment(x2, p2, JOINT_COLOR); } }
From source file:org.box2d.r3.gdx.GDXBox2DDebugRenderer.java
License:Apache License
private void drawJoint(final Joint joint) { final Body bodyA = joint.getBodyA(); final Body bodyB = joint.getBodyB(); final Transform xf1 = bodyA.getTransform(); final Transform xf2 = bodyB.getTransform(); final Vector2 x1 = xf1.getPosition(); final Vector2 x2 = xf2.getPosition(); final Vector2 p1 = joint.getAnchorA(); final Vector2 p2 = joint.getAnchorB(); if (joint.getType() == JointType.DistanceJoint) { this.drawSegment(p1, p2, this.JOINT_COLOR); } else if (joint.getType() == JointType.PulleyJoint) { final PulleyJoint pulley = (PulleyJoint) joint; final Vector2 s1 = pulley.getGroundAnchorA(); final Vector2 s2 = pulley.getGroundAnchorB(); this.drawSegment(s1, p1, this.JOINT_COLOR); this.drawSegment(s2, p2, this.JOINT_COLOR); this.drawSegment(s1, s2, this.JOINT_COLOR); } else if (joint.getType() == JointType.MouseJoint) { this.drawSegment(joint.getAnchorA(), joint.getAnchorB(), this.JOINT_COLOR); } else {/*from w ww .j av a2 s. c o m*/ this.drawSegment(x1, p1, this.JOINT_COLOR); this.drawSegment(p1, p2, this.JOINT_COLOR); this.drawSegment(x2, p2, this.JOINT_COLOR); } }