PhysicsAPI reference
Struct ContactEvent
Namespace: MicroEngine.Physics
Assembly: MicroEngine.Physics.dll
Guide: Physics worlds
Two shapes began or stopped touching during the latest Step; only pairs with at least one dynamic body report them (a kinematic body’s contacts come from MoveResult).
public readonly struct ContactEvent : IEquatable<ContactEvent>Implements
Constructors
ContactEvent(ContactEventKind, ShapeId, ShapeId, EntityId, EntityId, Vector2)
Two shapes began or stopped touching during the latest Step; only pairs with at least one dynamic body report them (a kinematic body’s contacts come from MoveResult).
public ContactEvent(ContactEventKind Kind, ShapeId A, ShapeId B, EntityId OwnerA, EntityId OwnerB, Vector2 Normal)Parameters
Kind ContactEventKind
Begin or end.
A ShapeId
The first shape.
B ShapeId
The second shape.
OwnerA EntityId
The entity owning A’s body.
OwnerB EntityId
The entity owning B’s body.
Normal Vector2
For a begin, the contact normal, unit length, pointing from A to B; zero for an end.
Properties
A
The first shape.
public ShapeId A { get; init; }Property Value
B
The second shape.
public ShapeId B { get; init; }Property Value
Kind
Begin or end.
public ContactEventKind Kind { get; init; }Property Value
Normal
For a begin, the contact normal, unit length, pointing from A to B; zero for an end.
public Vector2 Normal { get; init; }Property Value
OwnerA
The entity owning A’s body.
public EntityId OwnerA { get; init; }Property Value
OwnerB
The entity owning B’s body.
public EntityId OwnerB { get; init; }Property Value
Methods
Deconstruct(out ContactEventKind, out ShapeId, out ShapeId, out EntityId, out EntityId, out Vector2)
public void Deconstruct(out ContactEventKind Kind, out ShapeId A, out ShapeId B, out EntityId OwnerA, out EntityId OwnerB, out Vector2 Normal)Parameters
Kind ContactEventKind
A ShapeId
B ShapeId
OwnerA EntityId
OwnerB EntityId
Normal Vector2
Equals(object)
public override bool Equals(object obj)Parameters
obj object
Returns
Equals(ContactEvent)
public bool Equals(ContactEvent other)Parameters
other ContactEvent
Returns
GetHashCode()
public override int GetHashCode()Returns
ToString()
public override string ToString()Returns
Operators
operator ==(ContactEvent, ContactEvent)
public static bool operator ==(ContactEvent left, ContactEvent right)Parameters
left ContactEvent
right ContactEvent
Returns
operator !=(ContactEvent, ContactEvent)
public static bool operator !=(ContactEvent left, ContactEvent right)Parameters
left ContactEvent
right ContactEvent