Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.