PhysicsAPI reference
Struct MoveResult
Namespace: MicroEngine.Physics
Assembly: MicroEngine.Physics.dll
Guide: Physics worlds
What Move did: where the body ended, how far it went, and every surface it was stopped by or touches at the end (within the backend’s Skin), each one with its normal. A kinematic body’s contacts and its ground come from here, never from ContactEvents.
public readonly struct MoveResultConstructors
MoveResult(Vector2, Vector2, Vector2, ReadOnlySpan<MoveContact>)
Creates a result from the contacts the backend found (the first MaxContacts are kept).
public MoveResult(Vector2 position, Vector2 delta, Vector2 up, ReadOnlySpan<MoveContact> contacts)Parameters
position Vector2
The body’s origin after the move.
delta Vector2
The displacement actually applied.
up Vector2
The world’s up direction, which tells ground, walls and ceilings apart.
contacts ReadOnlySpan<MoveContact>
The contacts, in the order the backend found them.
Fields
GroundThreshold
The smallest dot product of a contact’s normal with Up that counts as ground (about 45 degrees); a dot product of at most its negation is a ceiling, anything between is a wall.
public const float GroundThreshold = 0.7Field Value
MaxContacts
The most contacts one result holds; further ones are counted in TotalContacts but not kept.
public const int MaxContacts = 8Field Value
Properties
Contacts
The contacts kept, in the order the backend found them.
[UnscopedRef]public ReadOnlySpan<MoveContact> Contacts { get; }Property Value
Delta
The displacement actually applied (the requested one when nothing was in the way).
public Vector2 Delta { get; }Property Value
Ground
The ground shape (GroundNormal’s); None when not on ground.
public ShapeId Ground { get; }Property Value
GroundNormal
The most upward ground normal; zero when OnGround is false.
public Vector2 GroundNormal { get; }Property Value
HitCeiling
Whether a contact is a ceiling (its normal points down).
public bool HitCeiling { get; }Property Value
HitWall
Whether a contact is a wall (neither ground nor ceiling).
public bool HitWall { get; }Property Value
OnGround
Whether a contact is ground: its normal points up within GroundThreshold.
public bool OnGround { get; }Property Value
Position
The body’s origin after the move.
public Vector2 Position { get; }Property Value
TotalContacts
How many contacts the backend found; Contacts holds at most MaxContacts of them.
public int TotalContacts { get; }Property Value
Methods
ToString()
public override string ToString()