Module sensor

Adds qualitative collision detection to a Body.

A Sensor is simply a rectangular area that is attached to and moves with a Body, but does not affect the physics of it. Sensors can detect other Sensors they are overlapping. They can also detect whether they are overlapping the map.

Sensor extends BoundObject

Properties

on_static (bool) (read only) Whether the Sensor is currently overlapping the map.
on_sensors (read only) A list of other Sensors this Sensor is currently overlapping with.
body (read only) The Body this Sensor is attached to.

Class Methods

Sensor:new (width, height, offset) Create a new Sensor


Properties

Properties. Significant fields on an instance.
on_static
(bool) (read only) Whether the Sensor is currently overlapping the map.
on_sensors
(read only) A list of other Sensors this Sensor is currently overlapping with.
body
(read only) The Body this Sensor is attached to.

Class Methods

Class Methods. Must be called on Class, with a capital leading character. e.g. Class:method("foo")
Sensor:new (width, height, offset)
Create a new Sensor

Parameters:

  • width number The width of the sensor in meters
  • height number The height of the sensor in meters
  • offset table An {x, y} vector of the offset from the center of the Body to which Sensor is attached. In meters.

Returns:

    Sensor
generated by LDoc 1.3.12