LogoLogo
VIVERSESupportBlogDiscord
  • Creator Tools
  • Polygon Streaming
  • Introduction to Creator Tools
  • Publishing with Your VIVERSE Account
  • Optimization
  • World Decoration
    • Edit Mode
    • Supported Media & Settings
    • Creating From Templates
      • Pet Rescue Template Project
  • PlayCanvas SDK
    • PlayCanvas Extension Setup
    • Publishing to VIVERSE
    • Scene Settings
    • No Code Tools
      • Sample Project
      • Quests
      • Trigger & Action
        • Event Listeners
        • Entity Enabling & Disabling
        • Entity Collision Enabling & Disabling
        • Entity Physics
        • Avatar Teleport & Checkpoint
        • Animation & Sound
        • Asset Management
      • Media
        • Polygon Streaming
        • Images
        • Video
        • Audio
      • Pick and Throw
      • Networked
      • Seat
      • GPU Mesh Instancing
    • Custom Code
      • Connecting No-Code Events to Custom Scripts
      • Introduction to MJS
      • Camera Management: Settings and Switching
      • Custom Loading Screens
      • Change Avatars Programatically
    • Examples
      • Create Your First PlayCanvas Project
      • SHADEART | Custom Shader
      • WITHIN | A Generative Audiovisual Maze
      • First Person Shooter with Destruction
  • Unity SDK
    • Porting from Unity to PlayCanvas
Powered by GitBook
LogoLogo

Important Links

  • COOKIE POLICY
  • TERMS OF SERVICE
  • PRIVACY POLICY
  • VIVERSE PARTNERS

Socials

  • X / Twitter
  • LinkedIn
  • Instagram

© 2025 HTC CORPORATION

On this page
  • EntityPlayAnimation
  • EntitySubscribeAnimationStart
  • EntitySubscribeAnimationEnd
  • EntitySubscribeAnimationEvent
  • EntityPlaySound
  • EntityStopSound

Was this helpful?

Edit on GitHub
Export as PDF
  1. PlayCanvas SDK
  2. No Code Tools
  3. Trigger & Action

Animation & Sound

This document provides several guides that can be used to setup event listeners for animations, control animations and control audio in a VIVERSE project.

PreviousAvatar Teleport & CheckpointNextAsset Management

Last updated 3 months ago

Was this helpful?

EntityPlayAnimation

Create An Action That Plays An Animation

This guide provides instructions for setting up the EntityPlayAnimation action. In the sample app, once the avatar enters the trigger area, the character switches to the dancing animation state. When the avatar leaves the trigger area, the character switches back to the idle animation state.

The character is in the idle state when the avatar is outside of the trigger area.

The character switches to the dancing animation state when the avatar enters the trigger area.

In this example, a trigger area is created and when triggered, an action plays an animation. Any object can be used as a trigger, as long as the object has a collision component.

1

Create the animation state graph

A. Create an Animation State Graph and rename the initial state to Idle.

B. Create an additional animation state and name it Dancing.

2

Configure 3D model for animation

A. Add a 3D model to the scene.

B. Add an Anim component.

C. Add the Animation State Graph.

D. Add the Idle animation.

E. Add the Dancing animation.

3

Create a trigger area

A. Create a new 3D Box entity.

B. The Collision component is not required for EntityPlayAnimation to work. The Collision component is required for the EntitySubscribeTriggerEnter trigger that will be used in this example.

C. Adding a material is optional. A transparent material has been added so that the trigger area is visible in play mode.

D. Click the Edit Viverse Extension button.

4

Add the EntityPlayAnimation action for the dancing animation state

A. In the VIVERSE extension, select the TriggerAndAction plugin for the Select plugins dropdown.

B. Add a Trigger and select EntitySubscribeTriggerEnter.

C. Add local-player to the tags to filter field.

D. Add an Action and select EntityPlayAnimation.

E. Add the name of an animation state to the animate state to play field. In this example, the animation state name is Dancing.

F. Add the 3d model to the pick up specify execution entity field.

5

Add the EntityPlayAnimation action for the Idle animation state

A. In the VIVERSE extension, select the TriggerAndAction plugin for the Select plugins dropdown.

B. Add a Trigger and select EntitySubscribeTriggerLeave.

C. Add local-player to the tags to filter field.

D. Add an Action and select EntityPlayAnimation.

E. Add the name of an animation state to the animate state to play field. In this example, the animation state name is Idle.

F. Add the 3d model to the pick up specify execution entity field.

EntitySubscribeAnimationStart

Create A Trigger Based On When An Animation Starts

This guide provides instructions for setting up the EntitySubscribeAnimationStart trigger. In the sample app, when the avatar enters the blue trigger area, the character’s dancing animation begins to play. The dancing animation has an animation event added and the animation event is triggered whenever the animation starts to play.

Before the character’s dancing animation begins.

When the character’s dancing animation begins, the animation event is triggered and text is displayed to show that the animation event was triggered.

In the EntityPlayAnimation example, a 3D model was added, an animation state graph was created, animation states were created and a trigger area was created to initiate the animations. In this example, an animation event is created for the start of the animation.

1

Open animation file that will have the animation event

A. Click on the animation file to open up the properties.

2

Create animation event

A. Create an event, add value 0 to the time field and start to the name field.

3

Add the EntitySubscribeAnimationStart trigger

A. In the VIVERSE extension, select the TriggerAndAction plugin for the Select plugins dropdown.

B. Add a Trigger and select EntitySubscribeAnimationStart.

C. Add an Action and select EntityEnableById.

D. For the EntityEnableById action to work, an object needs to be added that will be enabled. In this example, the AnimationStartText object is added.

EntitySubscribeAnimationEnd

Create A Trigger Based On When An Animation Ends

This guide provides instructions for setting up the EntitySubscribeAnimationEnd trigger. In the sample app, when the avatar enters the blue trigger area, the character’s dancing animation begins to play. The dancing animation has an animation event added and the animation event is triggered whenever the animation stops playing.

The character’s dancing animation has started.

When the character’s dancing animation ends, the animation event is triggered and text is displayed to show that the animation event was triggered.

In the EntityPlayAnimation example, a 3D model was added, an animation state graph was created, animation states were created and a trigger area was created to initiate the animations. In this example, an animation event is created for the end of the animation.

1

Open animation file that will have the animation event

A. Click on the animation file to open up the properties.

2

Create animation event

A. Create an event, add value 8 to the time field and end to the name field. The value 8 is used because the dancing animation has a duration of 8.83 seconds.

3

Add the EntitySubscribeAnimationEnd trigger

A. In the VIVERSE extension, select the TriggerAndAction plugin for the Select plugins dropdown.

B. Add a Trigger and select EntitySubscribeAnimationEnd.

C. Add an Action and select EntityEnableById.

D. For the EntityEnableById action to work, an object needs to be added that will be enabled. In this example, the AnimationEndText object is added.

EntitySubscribeAnimationEvent

Create A Trigger Based On A Specific Time During An Animation

This guide provides instructions for setting up the EntitySubscribeAnimationEvent trigger. In the sample app, when the avatar enters the blue trigger area, the character’s dancing animation begins to play. The dancing animation has an animation event added and the animation event is triggered during the animation.

The character’s dancing animation has started.

During the character’s dancing animation, the animation event is triggered and text is displayed to show that the animation event was triggered.

In the EntityPlayAnimation example, a 3D model was added, an animation state graph was created, animation states were created and a trigger area was created to initiate the animations. In this example, an animation event is created for during the animation.

1

Open animation file that will have the animation event

A. Click on the animation file to open up the properties.

2

Create animation event

A. Create an event, add value 4 to the time field and create a unique name for the event. In this example, the event name animate was added to the name field.

3

Add the EntitySubscribeAnimationEvent trigger

A. In the VIVERSE extension, select the TriggerAndAction plugin for the Select plugins dropdown.

B. Add a Trigger and select EntitySubscribeAnimationEvent.

C. Add the event name to the event name to subscribe.

D. Add an Action and select EntityEnableById.

E. For the EntityEnableById action to work, an object needs to be added that will be enabled. In this example, the AnimationEventText object is added.

EntityPlaySound

Create An Action That Plays A Sound

This guide provides instructions for setting up the EntityPlaySound action. In the sample app, once the avatar enters the trigger area, a sound plays.

The avatar is outside of the blue trigger area and the sound does not play.

The avatar enters the blue trigger area and the sound plays.

In this example, a trigger is created and when triggered, an action plays a sound. Any object can be used as a trigger, as long as the object has a collision component. This example uses a 3D box as the trigger area.

1

Create a trigger area

A. Create a new 3D Box entity.

B. The Collision component is not required for EntityPlaySound action to work. The Collision component is required for the EntitySubscribeTriggerEnter trigger that will be used in this example.

C. Adding a material is optional. A transparent material has been added so that the trigger area is visible in play mode.

D. Add a Sound component.

E. Create a unique name for the sound file and add it to the name field. In this example, Slot2 is added.

F. Add the audio file to the Asset field.

G. Click the Edit Viverse Extension button.

2

Add the EntityPlaySound action

A. In the VIVERSE extension, select the TriggerAndAction plugin for the Select plugins dropdown.

B. Add a Trigger and select EntitySubscribeTriggerEnter.

C. Add local-player to the tags to filter field.

D. Add an Action and select EntityPlaySound.

E. In the sound name to play field, add the same name that was created on the Sound component.

F. Add the entity with the Sound component to the pick up specify execution entity.

EntityStopSound

Create An Action That Stops Playing A Sound

This guide provides instructions for setting up the EntityStopSound action. In the sample app, once the avatar leaves the trigger area, the sound stops playing.

The avatar enters the blue trigger area and the sound plays.

The avatar is outside of the blue trigger area and the sound stops playing.

In this example, a trigger is created and when triggered, an action plays a sound. Any object can be used as a trigger, as long as the object has a collision component. This example uses a 3D box as the trigger area.

1

Create a trigger area

A. Create a new 3D Box entity.

B. The Collision component is not required for EntityStopSound action to work. The Collision component is required for the EntitySubscribeTriggerLeave trigger that will be used in this example.

C. Adding a material is optional. A transparent material has been added so that the trigger area is visible in play mode.

D. Add a Sound component.

E. Create a unique name for the sound file and add it to the name field. In this example, Slot2 is added.

F. Add the audio file to the Asset field.

G. Click the Edit Viverse Extension button.

2

Add the EntityStopSound action

A. In the VIVERSE extension, select the TriggerAndAction plugin for the Select plugins dropdown.

B. Add a Trigger and select EntitySubscribeTriggerLeave.

C. Add local-player to the tags to filter field.

D. Add an Action and select EntityStopSound.

E. In the sound name to play field, add the same name that was created on the Sound component.

F. Add the entity with the Sound component to the pick up specify execution entity.