Contact class
The contact data that is delivered to ContactCallbacks by the ContactEventsDispatcher.
Forge2D reports contacts as polled events after each step instead of through listener callbacks, and sensor overlaps arrive through a separate event stream. Contact wraps both streams in one type so that ContactCallbacks.beginContact and ContactCallbacks.endContact can be used for sensors and non-sensors alike.
Constructors
-
Contact.begin({required Shape shapeA, required Shape shapeB, required Vector2 normal, required List<
ContactPoint> points}) - Creates the contact for a begin-touch event.
- Contact.end({required Shape shapeA, required Shape shapeB})
- Creates the contact for an end-touch event.
- Contact.sensor({required Shape sensor, required Shape visitor})
- Creates the contact for a sensor begin or end event.
Properties
- bodyA → Body
-
The body of shapeA.
no setter
- bodyB → Body
-
The body of shapeB.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isSensorEvent → bool
-
Whether this contact comes from a sensor overlap event.
final
- isValid → bool
-
Whether both shapes still exist in the world.
no setter
- normal → Vector2?
-
The contact normal in world coordinates, pointing from shapeA to
shapeB.
final
-
points
→ List<
ContactPoint> ? -
The initial contact points, recorded before the solver ran.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sensor → Shape
-
The sensor shape of a sensor event.
no setter
- shapeA → Shape
-
The first shape, or the sensor shape for sensor events.
final
- shapeB → Shape
-
The second shape, or the visiting shape for sensor events.
final
-
userDatas
→ Set<
Object> -
The non-null userData of the bodies and shapes involved in this
contact, in the order body A, shape A, body B, shape B.
no setter
- visitor → Shape
-
The shape that entered or left the sensor of a sensor event.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited