Challenge — Animating Objects
Tutorial
·
Beginner
·
+10XP
·
30 mins
·
(57)
Unity Technologies

In this challenge, you will be animating a GameObject using Animation Clips. You will practice what you learned in the previous tutorial by applying clips to a simple Scene containing an asteroid.
Languages available:
1. Overview
In this challenge, you will animate a GameObject using Animation Clips. You will apply what you learned in the previous tutorial by animating a simple Scene containing an asteroid. Animation adds to a dynamic experience that is more exciting and immersive for your user.

The finished animations
In this challenge, you will animate the asteroid, rotating it 360 degrees:
- Create an Animation Clip
- Add the Rotation property and Keyframes
- Rotate the asteroid 360 degrees
2. Create an Animation Clip
Create an Animation Clip for the GameObject Asteroid2.

Opening the Animation window and creating an animation
- Open the Animation window by navigating to Window > Animation in your navigation bar.
- Select the GameObject Asteroid2 in your Hierarchy. With Asteroid2 selected, select Create in the Animation window.
- Name the Animation Rotate and save it to your Animations folder.
Tip — Expand GameObjects in the Hierarchy
To quickly expand a GameObject with many children/parent relationships, use Alt + Click to see all working parts.
3. Add the Rotation Property and Keyframes
Add the Rotation Property to your Dopesheet to expose values you can adjust
- Click Add Rotation to open up the property list.
- Select Transform > Rotation.
--------------------
Add a Keyframe at three seconds to mark the duration of your Animation Clip.
(Hint: Use the Add Keyframe button to add the Keyframe once you reach your desired time.)
1. Scroll with your mouse in the Dopesheet so you can see the three-second mark.

Adding a Keyframe
2. Scrub (drag) the white line to the two-second mark.
3. Click the Add Keyframe button.

The Add Keyframe button
4. Rotate the Asteroid 360 Degrees
Rotate the asteroid by adjusting its Y value at three seconds.

Adjusting the Rotation property in the Property List
(Hint: Expand Asteroid2 : Rotation in the Property List to find the Rotation.y field.)
- In your Dopesheet, expand Asteroid2 : Rotation.
- Place your scrubber at the end Keyframe (3:00).
- Input 360 for Position.y.
--------------------
Test your animation by pressing Play in the Animation window.

Previewing the animation
Press the play button in your Animation window to preview your animation in the Scene view.

The Play button in the Animation window
Tip — View Your Animation Frame by Frame
Instead of hitting play, scrub in your Dopesheet back and forth to control your animation preview.
5. Bonus Challenge
Add similar animations to all of the asteroids to create a more dynamic Scene using the skills you’ve acquired. Explore rotating each of the X, Y, and Z axes to change rotation direction.

The finished animation
6. Key Takeaways
Great job adding your first animations to different GameObjects! You should now be familiar with how to create a simple rotation animation using the Animation window, along with its various features, such as the:
- Animation Properties List
- Dopesheet
- Keyframes
- Animation
- Timeline