moveKinematic

fun moveKinematic(body: RigidBody, x: Float, y: Float, angle: Float = angleOf(body))(source)

Tells kinematic body to be at (x, y), turned by angle, at the end of the next step. It gets there at a steady velocity, which it pushes things with, and keeps that velocity after unless told again. Call it every step to have it follow a path exactly.

Throws

Samples

val world = PhysicsWorld()
val lift = world.rigidBody(Shape.box(60f, 10f), x = 0f, y = 200f, kind = BodyKind.KINEMATIC)
// Moved where it is told over the next step, pushing what stands on it on the way.
world.rigidBodies.moveKinematic(lift, x = 0f, y = 190f)
world.step(1.seconds / 60)
assertPrints(world.rigidBodies.yOf(lift), "190.0")