angleOf

fun angleOf(joint: Joint): Float(source)

Returns how far hinge joint's second end has turned against its first since it was made, in radians, clockwise on screen.

Samples

val world = PhysicsWorld()
val wheel = world.rigidBody(Shape.circle(10f), x = 0f, y = 0f)
val axle = world.joints.hinge(wheel, JointEnd.WORLD, x = 0f, y = 0f)
// Drives the world round the wheel at half a turn a second, so the wheel turns the other way.
world.joints.setMotor(axle, speed = PI.toFloat(), maxTorque = 1_000_000f)
repeat(60) { world.step(1.seconds / 60) }
assertPrints(world.rigidBodies.angularVelocityOf(wheel), "-3.1415927")