Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

In another recipe, we use Grabbables and Joints to make a car’s doors openable (see Car Door with Behaviour Model). This approach is not as great for the trunk, however, as most trunks are automated and open with a click. In this recipe, we’ll create Unity animations that automatically open and close the rear door.

Setup

Make sure to follow the setup steps in Car Door with Behaviour Model to ready the prefab.

Create the Animations

This document assumes you have a basic understanding of Unity’s animation system and can create simple animations. This is a good starting point if not:

https://docs.unity3d.com/Manual/AnimationSection.html

We’ll create two Animation Controllers that use the same clip to open and close the door. The “close” controller simply plays the clip backwards. We won’t walk through the creation step here, but here is what the two Animator Controllers look like:

Trunk_Lid_Open

Trunk_Lid_Close

Note that this one uses the same animation clip, but played with speed -1. For testing, make sure these two Animators are stored in a Resources folder so that they can be targeted by StoryFlow:

Note that animations like these can also be deployed as an Asset Bundle, but for testing it’s quickest to load them directly from the Resources folder.

Set Up StoryFlow

  1. Create a Unity Asset Catalog and add Trunk_Lid_Open and Trunk_Lid_Close (just the names):

  2. Create a Unity Animation Catalog and link two animations to these assets:

    Trunk_Lid_Close is being edited here to show the link to the underlying Unity Asset.

  3. Now you can use these animations at any time in your StoryFlow Scripts using the Apply Effect Resource. In this example, we open the door then close it again 5s later:

  • No labels