Skip to content

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).

C#
public readonly struct ContactEvent : IEquatable<ContactEvent>

Implements

IEquatable<ContactEvent>

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).

C#
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.

C#
public ShapeId A { get; init; }

Property Value

ShapeId

B

The second shape.

C#
public ShapeId B { get; init; }

Property Value

ShapeId

Kind

Begin or end.

C#
public ContactEventKind Kind { get; init; }

Property Value

ContactEventKind

Normal

For a begin, the contact normal, unit length, pointing from A to B; zero for an end.

C#
public Vector2 Normal { get; init; }

Property Value

Vector2

OwnerA

The entity owning A’s body.

C#
public EntityId OwnerA { get; init; }

Property Value

EntityId

OwnerB

The entity owning B’s body.

C#
public EntityId OwnerB { get; init; }

Property Value

EntityId

Methods

Deconstruct(out ContactEventKind, out ShapeId, out ShapeId, out EntityId, out EntityId, out Vector2)

C#
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)

C#
public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Equals(ContactEvent)

C#
public bool Equals(ContactEvent other)

Parameters

other ContactEvent

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(ContactEvent, ContactEvent)

C#
public static bool operator ==(ContactEvent left, ContactEvent right)

Parameters

left ContactEvent

right ContactEvent

Returns

bool

operator !=(ContactEvent, ContactEvent)

C#
public static bool operator !=(ContactEvent left, ContactEvent right)

Parameters

left ContactEvent

right ContactEvent

Returns

bool