Reader small image

You're reading from  Unity 5.x Animation Cookbook

Product typeBook
Published inMay 2016
Reading LevelExpert
PublisherPackt
ISBN-139781785883910
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Maciej Szczesnik
Maciej Szczesnik
author image
Maciej Szczesnik

Not interested. Too busy with current game project. Source: Linkedin.
Read more about Maciej Szczesnik

Right arrow

Animating an object's world position - creating a moving platform


In this recipe, we will create a very common gameplay mechanism: a moving platform. We will use a Rigid body for our character and an animated, kinematic Rigid body for the platform.

Getting ready

Before we start, you should have a scene with your character and a platform you want to animate. You can use the example project; go to the Chapter 02 Working with the animation view\Recipe 03 Animating objects world position - creating a moving platform directory. There is a scene called Example.unity there. If you open it, you will find a Sheep character in the Hierarchy. This is our character, using the Rigidbody component and a Simple Move script to move. There is also a Moving Platform game object in the Hierarchy. This is the kinematic rigid body with a Platform script attached to it. It also has an Animator component and an Animator Controller with just one animation in it. This animation makes the platform move.

How to do it...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Unity 5.x Animation Cookbook
Published in: May 2016Publisher: PacktISBN-13: 9781785883910

Author (1)

author image
Maciej Szczesnik

Not interested. Too busy with current game project. Source: Linkedin.
Read more about Maciej Szczesnik