UNPKG

hytopia

Version:

The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.

58 lines (28 loc) 1.14 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [server](./server.md) &gt; [Audio](./server.audio.md) &gt; [setReferenceDistance](./server.audio.setreferencedistance.md) ## Audio.setReferenceDistance() method Sets the reference distance of the audio. **Signature:** ```typescript setReferenceDistance(referenceDistance: number): void; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> referenceDistance </td><td> number </td><td> The reference distance. </td></tr> </tbody></table> **Returns:** void ## Remarks The reference distance defines the range within which the audio plays at full volume. When a listener is within this distance from the audio source, they will hear the sound at its maximum volume. Beyond this distance, the volume decreases linearly until reaching the cutoff distance, where the sound becomes inaudible. This creates a natural spatial audio experience with smooth volume falloff based on distance.