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.
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:
- In Reality Composer Pro 3, add
Input Target,Collision, andScriptingcomponents to your door entity so that it can receive tap events. - On the scripting component, select "edit" to enter the Script Graph editor.
- In the Script Graph editor, add an
On Tapnode and aMovenode. - Connect the
On Tapnode to theMovenode. This causes the logic in theMovenode to trigger whenever the your entity is tapped. - Adjust the transform and duration properties of the
Movenode to create your desired effect. For example, for a door opening animation you might set theOrientationproperty to(0.0, 90.0, 0.0)(so that the door rotates 90 degrees around the y-axis) and theDurationproperty to1.0. - 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:
- Create a new Sequence animation asset (in the Project Browser, Control-click > New > Sequence).
- Set the
Root Entityof the Sequence to be the root entity of the entity hierarchy you want to play the animation on. - Add a new track to the Sequence and select the specific entity you want to animate.
- 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.
- 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
Movenode in Script Graph. - Once you are satisfied with your animation, add an
Animation Librarycomponent to the root entity of the hierarchy and add your newly-created sequence to it. - In Script Graph, you can now use the
Play Named Animationnode to play the sequence animation you created by simply setting theNameproperty to the name of your sequence.
Let me know if you have questions about either of these potential approaches!