Struct CollisionEvent
An event raised when a pair of bodies have collided during solving.
Inherited Members
Namespace: Unity.Physics
Assembly: Unity.Physics.dll
Syntax
public struct CollisionEvent : ISimulationEvent<CollisionEvent>, IComparable<CollisionEvent>Properties
BodyIndexA
Gets the body index a.
Declaration
public int BodyIndexA { get; }Property Value
| Type | Description | 
|---|---|
| int | The body index a. | 
BodyIndexB
Gets the body index b.
Declaration
public int BodyIndexB { get; }Property Value
| Type | Description | 
|---|---|
| int | The body index b. | 
ColliderKeyA
Gets the collider key a.
Declaration
public ColliderKey ColliderKeyA { get; }Property Value
| Type | Description | 
|---|---|
| ColliderKey | The collider key a. | 
ColliderKeyB
Gets the collider key b.
Declaration
public ColliderKey ColliderKeyB { get; }Property Value
| Type | Description | 
|---|---|
| ColliderKey | The collider key b. | 
EntityA
Gets the entity a.
Declaration
public Entity EntityA { get; }Property Value
| Type | Description | 
|---|---|
| Entity | The entity a. | 
EntityB
Gets the entity b.
Declaration
public Entity EntityB { get; }Property Value
| Type | Description | 
|---|---|
| Entity | The entity b. | 
Normal
Gets the normal. The normal is pointing from the body B to the body A.
Declaration
public 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 | 
|---|---|
| int | Negative if this object is less than the other, 0 if they are equal, or positive if this is greater. |