How complicated should a tap-to-open animation for a box be in RCP3?

Before WWDC I had built a fairly simple tap-to-open suitcase where you could tap on an object inside to activate it. (Play audio, no are, etc) all of this was managed in the timeline, which no longer exists. This was really nice because the usdz file was easily shared as a storytelling tool.

in the new version… do I really need a model with a closed state, an open state and an opening and closing animations to do something like this? Is there a transform I can perform on an object with a tap instead of creating a specific animation separately? And then using script graphing and animation graphing?

I appreciate the in-depth tutorials to showcase the awesomefeatures, but I’m finding it hard to take the information for something as basic like this out of them.

even a simple description of how to tap and open a door would make things easier to understand.

Answered by Vision Pro Engineer in 894366022

Hi @nosarious,

As @JosephSimpson mentioned, this is achievable with Reality Composer 3's new Script Graph and Sequence features.

The most straightforward approach can be achieved exclusively with Script Graph. Here's how I'd go about doing that to implement a simple door open animation on tap:

  1. In Reality Composer Pro 3, add Input Target, Collision, and Scripting components to your door entity so that it can receive tap events.
  2. On the scripting component, select "edit" to enter the Script Graph editor.
  3. In the Script Graph editor, add an On Tap node and a Move node.
  4. Connect the On Tap node to the Move node. This causes the logic in the Move node to trigger whenever the your entity is tapped.
  5. Adjust the transform and duration properties of the Move node to create your desired effect. For example, for a door opening animation you might set the Orientation property to (0.0, 90.0, 0.0) (so that the door rotates 90 degrees around the y-axis) and the Duration property to 1.0.
  6. Press play to simulate your scene directly inside the editor and try tapping on your entity. You should see your move animation play on tap!

You could then add additional nodes to your Script Graph, such as the Play Named Audio node, to sequence additional actions when the player taps your object.

If you find yourself creating a more intricate animation that requires multiple sound effects with specific cues, or more complex motion, consider using the new Sequence feature to author a more elaborate timeline, just as Joseph suggests.

The key steps to authoring and playing a Sequence animation on tap are as follows:

  1. Create a new Sequence animation asset (in the Project Browser, Control-click > New > Sequence).
  2. Set the Root Entity of the Sequence to be the root entity of the entity hierarchy you want to play the animation on.
  3. Add a new track to the Sequence and select the specific entity you want to animate.
  4. Add actions to the track timeline, such as a "Play Audio" action and a "Motion Path" action. This is similar to Reality Composer Pro 2's Timeline feature, where you can sequence actions in a timeline editor and play/pause/preview functionality is all directly accessible in the editor.
  5. Add key points to the "Motion Path" action to create your transform animation. The "Motion Path" action allows you to author an animation path using a collection of points/transforms, enabling you to author more complex movements than a standalone Move node in Script Graph.
  6. Once you are satisfied with your animation, add an Animation Library component to the root entity of the hierarchy and add your newly-created sequence to it.
  7. In Script Graph, you can now use the Play Named Animation node to play the sequence animation you created by simply setting the Name property to the name of your sequence.

Let me know if you have questions about either of these potential approaches!

"managed in the timeline, which no longer exists" It's true that timeline no longer exists in RCP3, but it does have a new sequence feature which behaves and looks a lot like timeline.

The Behaviors Component is no longer available, so how we play these sequences will be a little different too. I haven't spent a lot of time with the tool yet, but I think you can use the new ScriptGraph to add an on tap event that will play the sequence. I'm not sure if we can play these sequences directly or if we have to go through the new behavior tree.

The short version is this: I asked one of the engineers at the Spatial Computing Lab about this, and they said everything that was possible with timeline should be possible with a new ScriptGraph and related features.

Accepted Answer

Hi @nosarious,

As @JosephSimpson mentioned, this is achievable with Reality Composer 3's new Script Graph and Sequence features.

The most straightforward approach can be achieved exclusively with Script Graph. Here's how I'd go about doing that to implement a simple door open animation on tap:

  1. In Reality Composer Pro 3, add Input Target, Collision, and Scripting components to your door entity so that it can receive tap events.
  2. On the scripting component, select "edit" to enter the Script Graph editor.
  3. In the Script Graph editor, add an On Tap node and a Move node.
  4. Connect the On Tap node to the Move node. This causes the logic in the Move node to trigger whenever the your entity is tapped.
  5. Adjust the transform and duration properties of the Move node to create your desired effect. For example, for a door opening animation you might set the Orientation property to (0.0, 90.0, 0.0) (so that the door rotates 90 degrees around the y-axis) and the Duration property to 1.0.
  6. Press play to simulate your scene directly inside the editor and try tapping on your entity. You should see your move animation play on tap!

You could then add additional nodes to your Script Graph, such as the Play Named Audio node, to sequence additional actions when the player taps your object.

If you find yourself creating a more intricate animation that requires multiple sound effects with specific cues, or more complex motion, consider using the new Sequence feature to author a more elaborate timeline, just as Joseph suggests.

The key steps to authoring and playing a Sequence animation on tap are as follows:

  1. Create a new Sequence animation asset (in the Project Browser, Control-click > New > Sequence).
  2. Set the Root Entity of the Sequence to be the root entity of the entity hierarchy you want to play the animation on.
  3. Add a new track to the Sequence and select the specific entity you want to animate.
  4. Add actions to the track timeline, such as a "Play Audio" action and a "Motion Path" action. This is similar to Reality Composer Pro 2's Timeline feature, where you can sequence actions in a timeline editor and play/pause/preview functionality is all directly accessible in the editor.
  5. Add key points to the "Motion Path" action to create your transform animation. The "Motion Path" action allows you to author an animation path using a collection of points/transforms, enabling you to author more complex movements than a standalone Move node in Script Graph.
  6. Once you are satisfied with your animation, add an Animation Library component to the root entity of the hierarchy and add your newly-created sequence to it.
  7. In Script Graph, you can now use the Play Named Animation node to play the sequence animation you created by simply setting the Name property to the name of your sequence.

Let me know if you have questions about either of these potential approaches!

Thank you very much! I had managed to have it open, but only to the final state using Set Transform. That node has 'rotation' instead of 'orientation'. I was going to try the move, but didn't understand how 'orientation' was ''rotation'.

Any idea who a move node would require two clicks to activate the first time where the transform node activated with a single click?

Hi @nosarious,

A Move node should only require one "click" to activate, assuming your Script Graph is assembled as described above. If you're able to tell me more about your specific Script Graph setup I can help determine what might be going on.

Thanks!

Thank you. I hope this gives a bit of context to the way I have it set up. When the Move nodes are replaced with instant-open transforms, it is only one click to open the lid. If they are move nodes, the first time needs two opens.

This has logic to click on the lid to open and close it.

I can make the project available, if you like.

How complicated should a tap-to-open animation for a box be in RCP3?
 
 
Q