PhysicsWorld.GetContacts Method
| Overloads | |
|---|---|
| GetContacts(PhysicsBodyComponent, Span<ContactPair>) | Reads the live contact manifolds for body directly from Box2D and writes them into results. Returns 0 if the body is not live, has no active contacts, or results is empty. |
| GetContacts(PhysicsBodyComponent, Span<ContactPair>, bool) | Reads the live contact manifolds for body directly from Box2D and writes them into results. Returns 0 if the body is not live, has no active contacts, or results is empty. |
PhysicsWorld.GetContacts(PhysicsBodyComponent, Span\<ContactPair>) Method¶
Reads the live contact manifolds for body directly from Box2D and writes them into results. Returns 0 if the body is not live, has no active contacts, or results is empty.
public int GetContacts(Brine2D.ECS.Components.PhysicsBodyComponent body, System.Span<Brine2D.Physics.ContactPair> results);
Parameters¶
body PhysicsBodyComponent
The body to query contacts for.
results System.Span<ContactPair>
Buffer to receive contact pairs.
Returns¶
System.Int32
Number of contacts written.
Remarks¶
This reads live Box2D contact data and is safe to call any time after the first
Brine2D.Physics.PhysicsWorld.Step(System.Single). Contact normals are oriented away from the other body toward
body, consistent with OnCollisionEnter.
When the number of live contacts exceeds results.Length,
the result is clipped and wasTruncated is set to true.
Use GetContactsAll(PhysicsBodyComponent, List<ContactPair>) for guaranteed-complete results.
PhysicsWorld.GetContacts(PhysicsBodyComponent, Span\<ContactPair>, bool) Method¶
Reads the live contact manifolds for body directly from Box2D and writes them into results. Returns 0 if the body is not live, has no active contacts, or results is empty.
public int GetContacts(Brine2D.ECS.Components.PhysicsBodyComponent body, System.Span<Brine2D.Physics.ContactPair> results, out bool wasTruncated);
Parameters¶
body PhysicsBodyComponent
The body to query contacts for.
results System.Span<ContactPair>
Buffer to receive contact pairs.
wasTruncated System.Boolean
Set to true when there were more contacts than results could hold.
Returns¶
System.Int32
Number of contacts written.
Remarks¶
This reads live Box2D contact data and is safe to call any time after the first
Brine2D.Physics.PhysicsWorld.Step(System.Single). Contact normals are oriented away from the other body toward
body, consistent with OnCollisionEnter.
When the number of live contacts exceeds results.Length,
the result is clipped and wasTruncated is set to true.
Use GetContactsAll(PhysicsBodyComponent, List<ContactPair>) for guaranteed-complete results.