Aktor > Sensor#
Sensoren sind Hilfs-Actors, die an einen anderen Actor angehaengt werden koennen, um nahe Objekte und Interaktionen zu erkennen.
API-Referenz#
Sensor#
- class miniworlds.actors.sensors.sensor_actor.Sensor(actor, *args, **kwargs)[Quellcode]
An invisible sensor attached to another actor.
A Sensor follows the actor it is attached to and detects nearby objects. The sensor itself is not visible and will never detect the actor it belongs to.
Use actor.register_sensor(Sensor) to attach a sensor to an actor.
- Parameter:
actor – The parent actor this sensor is attached to.
Examples
player = Actor((100, 100)) player.register_sensor(Sensor)
Kreissensor#
- class miniworlds.actors.sensors.circle_sensor.CircleSensor(actor, distance, **kwargs)[Quellcode]
A circular invisible sensor attached to another actor.
CircleSensor creates a circular detection area around the parent actor. Any actor that overlaps with this circle will be detected. The sensor itself is invisible and never detects the parent actor.
Use actor.register_sensor(CircleSensor, distance=<pixels>) to attach it.
- Parameter:
actor – The parent actor this sensor belongs to.
distance – Radius of the circular detection area in pixels.
Examples
player = Actor((100, 100)) player.register_sensor(CircleSensor, distance=50)