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 Rotate the Player Towards the Target

alexvalladares
alexvalladares
21,478 Points

rotation vs moveRotation()

Hi there! In the video it shows as we use the moveRotation method and the lerp to smoothly rotate the player, in the documentation we see:

"Set Rigidbody.rotation instead, if you want to teleport a rigidbody from one rotation to another, with no intermediate positions being rendered."

I've done this for testing, but I see no difference between two ways. The frog rotates the same way in both methods.

Regards!

alexvalladares
alexvalladares
21,478 Points

Well, I slightly see a difference, but very very light. I've tried increasing the turningSpeed value but no effect at all, even with ridiculous values (2000).

1 Answer

Nick Pettit
STAFF
Nick Pettit
Treehouse Teacher

Setting the Rigidbody.rotation variable directly does not take a Rigidbody's interpolation setting into account, but using Rigidbody.MoveRotation() does.