Struct CollisionEvent
An event raised when a pair of bodies have collided during solving.
Inherited Members
Namespace: Unity.Physics
Syntax
public struct CollisionEvent : ISimulationEvent<CollisionEvent>, IComparable<CollisionEvent>
Properties
BodyIndexA
Gets the body index a.
Declaration
public readonly int BodyIndexA { get; }
Property Value
Type | Description |
---|---|
Int32 | The body index a. |
Implements
BodyIndexB
Gets the body index b.
Declaration
public readonly int BodyIndexB { get; }
Property Value
Type | Description |
---|---|
Int32 | The body index b. |
Implements
ColliderKeyA
Gets the collider key a.
Declaration
public readonly ColliderKey ColliderKeyA { get; }
Property Value
Type | Description |
---|---|
ColliderKey | The collider key a. |
Implements
ColliderKeyB
Gets the collider key b.
Declaration
public readonly ColliderKey ColliderKeyB { get; }
Property Value
Type | Description |
---|---|
ColliderKey | The collider key b. |
Implements
EntityA
Gets the entity a.
Declaration
public readonly Entity EntityA { get; }
Property Value
Type | Description |
---|---|
Entity | The entity a. |
Implements
EntityB
Gets the entity b.
Declaration
public readonly Entity EntityB { get; }
Property Value
Type | Description |
---|---|
Entity | The entity b. |
Implements
Normal
Gets the normal. The normal is pointing from the body B to the body A.
Declaration
public readonly float3 Normal { get; }
Property Value
Type | Description |
---|---|
float3 | The normal. |
Methods
CalculateDetails(ref PhysicsWorld)
Calculate extra details about the collision. Note: Since the solver does not naturally produce this data, it requires some computation.
Declaration
public CollisionEvent.Details CalculateDetails(ref PhysicsWorld physicsWorld)
Parameters
Type | Name | Description |
---|---|---|
PhysicsWorld | physicsWorld | [in,out] The physics world. |
Returns
Type | Description |
---|---|
CollisionEvent.Details | The calculated details. |
CompareTo(CollisionEvent)
Compares this CollisionEvent object to another to determine their relative ordering.
Declaration
public int CompareTo(CollisionEvent other)
Parameters
Type | Name | Description |
---|---|---|
CollisionEvent | other | Another instance to compare. |
Returns
Type | Description |
---|---|
Int32 | Negative if this object is less than the other, 0 if they are equal, or positive if this is greater. |