From 3f245e130783f1dea04146c55552356d6fb54625 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Thu, 2 Apr 2026 19:33:56 +0200 Subject: [PATCH] Add sound interaction actions and options --- src/interactions/interaction-links.ts | 32 ++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/interactions/interaction-links.ts b/src/interactions/interaction-links.ts index 4713506d..554cfd78 100644 --- a/src/interactions/interaction-links.ts +++ b/src/interactions/interaction-links.ts @@ -26,7 +26,23 @@ export interface StopAnimationAction { targetModelInstanceId: string; } -export type InteractionAction = TeleportPlayerAction | ToggleVisibilityAction | PlayAnimationAction | StopAnimationAction; +export interface PlaySoundAction { + type: "playSound"; + targetSoundEmitterId: string; +} + +export interface StopSoundAction { + type: "stopSound"; + targetSoundEmitterId: string; +} + +export type InteractionAction = + | TeleportPlayerAction + | ToggleVisibilityAction + | PlayAnimationAction + | StopAnimationAction + | PlaySoundAction + | StopSoundAction; export interface InteractionLink { id: string; @@ -139,6 +155,20 @@ export interface CreateStopAnimationInteractionLinkOptions { targetModelInstanceId: string; } +export interface CreatePlaySoundInteractionLinkOptions { + id?: string; + sourceEntityId: string; + trigger?: InteractionTriggerKind; + targetSoundEmitterId: string; +} + +export interface CreateStopSoundInteractionLinkOptions { + id?: string; + sourceEntityId: string; + trigger?: InteractionTriggerKind; + targetSoundEmitterId: string; +} + export function createPlayAnimationInteractionLink(options: CreatePlayAnimationInteractionLinkOptions): InteractionLink { assertNonEmptyString(options.sourceEntityId, "Interaction source entity id"); assertNonEmptyString(options.targetModelInstanceId, "Play animation target model instance id");