setResponse
Sets what body does to what it overlaps. A ContactResponse.SENSE body, a sensor, never pushes or is pushed: it only notices what is in it, and Events.sensorsEntered and Events.sensorsExited say what came and went. It notices rigid bodies, soft bodies and loose particles its layers let it collide with, but not the solids or other sensors, and raycasts pass through it. It moves as its kind says, so a dynamic sensor falls; most are static, or kinematic to carry them about.
Samples
val world = PhysicsWorld()
val zone = world.rigidBody(Shape.box(100f, 100f), x = 0f, y = 0f, kind = BodyKind.STATIC)
world.rigidBodies.setResponse(zone, ContactResponse.SENSE)
val crate = world.rigidBody(Shape.box(10f, 10f), x = 0f, y = -20f)
world.step(1.seconds / 60)
// A sensor pushes nothing: the crate is inside it, and it reports that.
assertPrints(world.events.sensorsEntered.size, "1")
assertTrue(world.rigidBodies.yOf(crate) > -20f)Content copied to clipboard