PhysicsWorld.GetShapeDistance Method
Definition¶
Namespace: Brine2D.Physics
| Overloads | |
|---|---|
| GetShapeDistance(PhysicsBodyComponent, PhysicsBodyComponent) | Computes the minimum separation distance (or penetration depth) between two live bodies. Iterates over every shape pair across the two bodies and returns the result for the closest (or most-overlapping) pair. |
| GetShapeDistance(PhysicsBodyComponent, PhysicsBodyComponent, Vector2, Vector2) | Computes the minimum separation distance (or penetration depth) between two live bodies. Iterates over every shape pair across the two bodies and returns the result for the closest (or most-overlapping) pair. |
| GetShapeDistance(PhysicsBodyComponent, PhysicsBodyComponent, Vector2, Vector2, Vector2) | Computes the minimum separation distance between two live bodies and returns a separation normal pointing from b toward a — i.e. the direction to push a to resolve the overlap (MTV direction). |
PhysicsWorld.GetShapeDistance(PhysicsBodyComponent, PhysicsBodyComponent) Method¶
Computes the minimum separation distance (or penetration depth) between two live bodies. Iterates over every shape pair across the two bodies and returns the result for the closest (or most-overlapping) pair.
public float GetShapeDistance(Brine2D.ECS.Components.PhysicsBodyComponent a, Brine2D.ECS.Components.PhysicsBodyComponent b);
Parameters¶
First body.
Second body.
Returns¶
System.Single
Positive values indicate separation (pixels); negative values indicate overlap/penetration.
Returns System.Single.MaxValue when either body has no live shapes.
PhysicsWorld.GetShapeDistance(PhysicsBodyComponent, PhysicsBodyComponent, Vector2, Vector2) Method¶
Computes the minimum separation distance (or penetration depth) between two live bodies. Iterates over every shape pair across the two bodies and returns the result for the closest (or most-overlapping) pair.
public float GetShapeDistance(Brine2D.ECS.Components.PhysicsBodyComponent a, Brine2D.ECS.Components.PhysicsBodyComponent b, out System.Numerics.Vector2 pointOnA, out System.Numerics.Vector2 pointOnB);
Parameters¶
First body.
Second body.
pointOnA System.Numerics.Vector2
Closest point on body A in pixel coordinates, or System.Numerics.Vector2.Zero when either body is not live.
pointOnB System.Numerics.Vector2
Closest point on body B in pixel coordinates, or System.Numerics.Vector2.Zero when either body is not live.
Returns¶
System.Single
Positive values indicate separation (pixels); negative values indicate overlap/penetration.
Returns System.Single.MaxValue when either body has no live shapes.
PhysicsWorld.GetShapeDistance(PhysicsBodyComponent, PhysicsBodyComponent, Vector2, Vector2, Vector2) Method¶
Computes the minimum separation distance between two live bodies and returns a separation normal pointing from b toward a — i.e. the direction to push a to resolve the overlap (MTV direction).
public float GetShapeDistance(Brine2D.ECS.Components.PhysicsBodyComponent a, Brine2D.ECS.Components.PhysicsBodyComponent b, out System.Numerics.Vector2 pointOnA, out System.Numerics.Vector2 pointOnB, out System.Numerics.Vector2 separationNormal);
Parameters¶
First body.
Second body.
pointOnA System.Numerics.Vector2
Closest point on body A in pixel coordinates.
pointOnB System.Numerics.Vector2
Closest point on body B in pixel coordinates.
separationNormal System.Numerics.Vector2
Unit vector from b toward a at the closest feature pair. Falls back to System.Numerics.Vector2.UnitY when the shapes are exactly coincident or either body is not live.
Returns¶
System.Single
Positive values indicate separation (pixels); negative values indicate penetration depth.
Returns System.Single.MaxValue when either body has no live shapes.