setMotion
Sets how body moves. A Motion.BULLET is not held to PhysicsConfig.maxStep a substep: it goes as fast as it is thrown, and every substep it is swept from where it was to where it went and stopped where it first meets a body or a solid, so nothing fast passes through a thin wall or another body. It costs a few shape tests a substep for each bullet; use it for the few things that need it.
Samples
val world = PhysicsWorld()
val shot = world.rigidBody(Shape.circle(2f), x = 0f, y = 0f)
// Swept each substep, so it can go as fast as it likes and never passes through a wall.
world.rigidBodies.setMotion(shot, Motion.BULLET)
world.rigidBodies.setVelocity(shot, 8_000f, 0f)
assertPrints(world.rigidBodies.motionOf(shot), "BULLET")Content copied to clipboard