Notifications
Article
Making Things Grow
Published 2 years ago
798
0
How we animate growing vegetation in Pode
Hi, I'm Henrik from Henchman & Goon working as Lead Designer on Pode, a puzzle-adventure about friendship and co-operation. We were one of the lucky ones who got selected to show off our game at the Made with Unity Showcase at Unite 2016. While showing of our demo, several people asked if we could explain how we implement growing plants, flowers, leaves and other decorations in our scenes. This is my attempt to do just that.
In short, we divide our process into three steps. 
First, we create and animate prefabs - the individual or collections of plants and stuff that we place in our scenes. 
Second, we place the prefabs in the scene according to how we want the scene to look after everything has finished growing.
Third, we hook the placed prefabs up to triggers with scripts that determine how and when the prefabs should grow.
Let’s take this weird bubble leaf thing as an example. This was modeled in Blender and textured with Photoshop.
We animate our 3D assets using Blender and/or Unity’s built-in animation system and scripting. For most of our smaller plants and decorative elements we use both, but for different aspects of the animation. For this leaf, we only used blender to create a shape key (also known as blend shape or morph target in other 3D applications) in order to animate the actual shape of the mesh.
When we import the mesh into Unity, the shape key becomes a blend shape value on the skinned mesh renderer of the game object using the mesh. We can then add an Animator component to the game object and create animation clips that animate the scale and rotation of the object as well as the value of the blend shape (top tip: never animate the transform of the root game object, only child objects, or else the animation will override the location, orientation and scale of the prefab during runtime). A nice thing with this setup is that we can reuse the Animator and clips for other meshes, as long as they share the same names for the blend shapes and child objects used in the animation clips.
Now we can make the animated leaf into a prefab and start placing it with other prefabs in a scene. As I said before, we place our prefabs the way we want our scene to look like when everything is fully-grown, like the example below.
We then let scripts control how each individual prefab should grow during gameplay (or, if the player has already completed an area, set the prefabs to start fully-grown). Usually when playing through an area of the game for the first time, nothing grows until Stella, one of the two playable characters, shines her magical light near it. We use simple triggers placed at specific points in the scene that detect when Stella is within range and shining. 
These triggers have a simple script with a list of Prefabs. When triggered, the script goes through the list and activates the prefabs one by one, waiting for a specified amount of time between each prefab.
On top of this, each prefab may have its own list of things to grow, which triggers as soon as that prefab is activated by the root script. This gives us a wide range of options for how we want to compose the the growth of our decorative plants. Also, the scripts can used for anything we want to activate in a specific order and frequency, not just plants.
That’s how we do it currently. We’re also experimenting with tweaks and additions to this setup, like animated materials and particle effects for added juice and gameplay feedback. 
Thanks for reading.
 
MF
Morten Formo
5
Comments