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 Make a Follow Camera

Colby Doyle
Colby Doyle
197 Points

I just wrote up the new code for the camera.. But now when I press play my frog doesnt move anymore And...

And the camera Isnt even on the frog anymore.. I looked at both codes but they look normal.. I dont know how to fix it.

CODE: https://gyazo.com/b41f9d705cc836fdfbf4b6af26b7fd8e

Edit: By Dane E. Parchment Jr. (Moderator)

Dane Parchment
Dane Parchment
Treehouse Moderator 11,075 Points

Show us your code so that we can help you debug the problem!

Colby Doyle
Colby Doyle
197 Points

Does anyone know what the problem is?!?!

2 Answers

Randy Eichelberger
Randy Eichelberger
445 Points

It looks like you're missing the code that controls the movement itself. In the if statement on the player script.

volkan Keskin
volkan Keskin
698 Points

You are missing the code that does the rotation for the player movement;

......................................

if ( movement != Vector3.zero) {

        Quaternion targetRotation = Quaternion.LookRotation(movement, Vector3.up);
        Quaternion newRotation = Quaternion.Lerp(playerRigidbody.rotation, targetRotation, turningSpeed * Time.deltaTime);

        playerRigidbody.MoveRotation(newRotation);

        playerAnimator.SetFloat ("Speed", 3f);
    }

................................