class SceneAudioAsset
// Load an audio file
val audioAsset = SceneAudioAsset.loadLocalFile("data/common/audio/click.ogg")
// Play the sound at a specific position in 3D space
scene.playSound(audioAsset, Vector3(0f, 1.7f, -1f), volume = 0.8f)
// Play the sound attached to an entity
scene.playSound(audioAsset, myEntity, volume = 1.0f)
// Play the sound attached to the user (non-spatialized)
scene.playSound(audioAsset, volume = 0.5f)
// Play looping background music
scene.playBackgroundSound(audioAsset, volume = 0.3f, looping = true)
// When done with the asset, release resources
audioAsset.destroy()
| Name | Summary |
|---|---|
Companion | object Companion |
| Name | Summary |
|---|---|
canBeSpatialized | val canBeSpatialized: Boolean Whether the audio can be positioned in 3D space |
duration | val duration: Float Length of the audio in seconds |
handle | var handle: Long Native handle to the audio asset |
spatialInterface_ | val spatialInterface_: SpatialInterface |
| Name | Summary |
|---|---|
destroy | fun destroy() |
object Companion
| Name | Summary |
|---|---|
spatialInterface | var spatialInterface: SpatialInterface? |
| Name | Summary |
|---|---|
loadLocalFile | fun loadLocalFile(filename: String): SceneAudioAsset Loads an audio file from the local filesystem. |