class in Clatter.Core
Audio data for a Clatter object.
Audio generation in Clatter is always the result of a collision event between two ClatterObjectData objects. Each object in your scene or simulation must have corresponding ClatterObjectData.
In many cases, it is possible to derive the ClatterObjectData constructor parameters from other physical values. See: ImpactMaterialData
.
Name | Type | Description | Default Value |
---|---|---|---|
id | uint | The ID of the object. This must always be unique. Readonly. | |
impactMaterial | ImpactMaterial |
The impact material. Readonly. | |
scrapeMaterial | ScrapeMaterial |
The scrape material. Readonly. | |
hasScrapeMaterial | bool | If true, this object has a scrape material. Readonly. | |
amp | double | The audio amplitude (0 to 1). This affects the overall loudness of audio generated by this object. Readonly. | |
resonance | double | The resonance value. This affects the decay times of audio generated by this object. The value is clamped to be at least 0 and usually should be below 1. Readonly. | |
mass | double | The mass of the object in kilograms. Readonly. | |
speed | double | The directional speed of the object in meters per second. | |
angularSpeed | double | The angular speed of the object in meters per second. |
public ClatterObjectData(uint id, ImpactMaterial impactMaterial, double amp, double resonance, double mass, ScrapeMaterial? scrapeMaterial=null)
Name | Type | Description |
---|---|---|
id | uint | The ID of this object. |
impactMaterial | ImpactMaterial |
The impact material. |
amp | double | The audio amplitude (0 to 1). This affects the overall loudness of audio generated by this object. |
resonance | double | The resonance value. This affects the decay times of audio generated by this object. The value is clamped to be at least 0 and usually should be below 1. |
mass | double | The mass of the object. |
scrapeMaterial | ScrapeMaterial |
The scrape material. Can be null. |
This is a minimal example of how to instantiate a ClatterObjectData:
using Clatter.Core;
public class ClatterObjectDataConstructor
{
private ClatterObjectData a = new ClatterObjectData(0, ImpactMaterial.glass_1, 0.2, 0.2, 1);
}
To generate scrape audio, the object acting as the "scrape surface" must have a ScrapeMaterial. For example, if you want to scrape a block along a table, the table needs a ScrapeMaterial (and the block doesn't). This is a minimal example of how to set an object's ScrapeMaterial:
using Clatter.Core;
public class ClatterObjectDataConstructorScrapeMaterial
{
private ClatterObjectData a = new ClatterObjectData(0, ImpactMaterial.glass_1, 0.2, 0.2, 1, ScrapeMaterial.ceramic);
}