CollisionEvent

struct in Clatter.Core

A CollisionEvent stores collision data, which will later be converted into audio data.

Typically, a CollisionEvent is used in the background to convert physics collision data into an audio event. If you want to generate audio outside of a physics-driven simulation context, you don't need to use CollisionEvents.

Fields

Name Type Description Default Value
primary ClatterObjectData The primary object. This should always be the faster-moving object. Readonly.
secondary ClatterObjectData The secondary object. This should always be the slower-moving (or non-moving) object. Readonly.
ids ulong The combined object IDs pair as a ulong. This is used by AudioGenerator as a dictionary key. Readonly.
type AudioEventType The type of the audio event (impact, scrape, roll, none). Readonly.
position Vector3d The position of the collision. Readonly.
speed double The speed of the collision in meters per second. Readonly.

Static Methods

GetIds

public static ulong GetIds(ClatterObjectData primary, ClatterObjectData secondary)

Returns an object ID pair as a ulong. Source: 827267

Name Type Description
primary ClatterObjectData The primary object.
secondary ClatterObjectData The secondary object.

Methods

CollisionEvent

public CollisionEvent(ClatterObjectData primary, ClatterObjectData secondary, AudioEventType type, double speed, Vector3d position)

Name Type Description
primary ClatterObjectData The primary object.
secondary ClatterObjectData The secondary object.
type AudioEventType The type of the audio event (impact, scrape, roll, none).
speed double The speed of the collision in meters per second.
position Vector3d The position of the collision.

CollisionEvent

public CollisionEvent(ulong ids, ClatterObjectData primary, ClatterObjectData secondary, AudioEventType type, double speed, Vector3d position)

Name Type Description
ids ulong The object IDs pair.
primary ClatterObjectData The primary object.
secondary ClatterObjectData The secondary object in meters per second.
type AudioEventType The type of the audio event (impact, scrape, roll, none).
speed double The speed of the collision in meters per second.
position Vector3d The position of the collision.