Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development How to Make a Video Game Player Input and Cameras Move the Player with Animation

Odd movement

So I found something that is a little odd with the movement of the frog.

If I move left one time and then hit up and down repeatedly my frog with zig-zag up an down continually in a left hand direction (or right if I hit right first). Likewise if I hit up or down once and then toggle left and right repeatedly the frog will zig-zag left and right in the initial direction (up or down) is this intended?

What causes this?

1 Answer

Nick Pettit
STAFF
Nick Pettit
Treehouse Teacher

Hi John,

This occurs because - if you press the keys quickly enough - the frog doesn't have time to turn towards either the up or down directions. Instead, the jumping animation plays (which is actually what moves the frog) while the frog is stuck between the two rotations.

If this is bothersome, a simple fix is to increase the rotation speed; i.e., the amount of time it takes to lerp from one quaternion to another.

Oh not bothersome at all, just something I noticed and was curious as to why it works the way it does. I am really enjoying this course.