Class b2ContactListener
Told about contacts as they begin and end touching (pybox2d's contactListener, which Gymnasium's envs
subclass as ContactDetector). The callbacks run inside Step(double, int, int), while the world is
locked.
public class b2ContactListener
- Inheritance
-
b2ContactListener
- Derived
- Inherited Members
- Extension Methods
Remarks
Footgun: do not create or destroy bodies, fixtures or joints from a callback; the world is locked and refuses with an AssertionError. Record what to change and do it after the step, as Gymnasium's envs do.
Methods
BeginContact(b2Contact)
Called when two fixtures begin to touch (the contact's first touching update; sensors included).
public virtual void BeginContact(b2Contact contact)
Parameters
contactb2ContactThe contact.
EndContact(b2Contact)
Called when two fixtures cease to touch, including when their contact is destroyed while touching.
public virtual void EndContact(b2Contact contact)
Parameters
contactb2ContactThe contact.