Description
The LocalTransform
property of the SoundHandle
class represents the local transformation of the sound relative to its parent. This property is particularly useful when the sound is set to follow a parent object, allowing you to define the sound's position and orientation in relation to that parent.
Usage
Use the LocalTransform
property to set or get the local transformation of a sound when it is following a parent. This transformation includes position, rotation, and scale relative to the parent object.
Example
// Example of setting the LocalTransform property
SoundHandle soundHandle = new SoundHandle();
// Assuming the sound is following a parent, set its local transform
soundHandle.LocalTransform = new Transform
{
Position = new Vector3(1.0f, 0.0f, 0.0f),
Rotation = Rotation.From(0, 90, 0),
Scale = new Vector3(1.0f, 1.0f, 1.0f)
};
// Retrieve the local transform
Transform localTransform = soundHandle.LocalTransform;
Vector3 localPosition = localTransform.Position;
Rotation localRotation = localTransform.Rotation;
Vector3 localScale = localTransform.Scale;