Add sound interaction actions and options

This commit is contained in:
2026-04-02 19:33:56 +02:00
parent 0cb7f93987
commit 3f245e1307

View File

@@ -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");