Bummer! You have been redirected as the page you requested could not be found.

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 Create a Target Rotation

MonoDevelop is not loading all of the items.

game plugins and game editor are showing up as unknown item types causing

private Animator playerAnimator;

private Vector3 movement;

private Rigidbody playerRigibody;

not to turn blue

2 Answers

Nick Pettit
STAFF
Nick Pettit
Treehouse Teacher

Hi Jeremy,

Can you post the entirety of this script? That will help a lot!

public class PlayerMovement : MonoBehaviour {

private Animator playerAnimator;
private float moveHorizontal;
private float moveVertical;
private Vector3 movement;
private float turningSpeed = 20f;
private Rigidbody playerRigidbody;

// Use this for initialization
void Start () {

    // Gather componets from the Player Gameobject
    playerAnimator = GetComponet<Animator> (); 
    Rigidbody = Getcomponet<Rigidbody> (); 

}

// Update is called once per frame
void Update () {

    // Gather input from the keyboard
    moveHorizontal = input.GetAxisRaw ("Horizontal"); 
    moveVertical = input.GetAxisRaw ("Vertical");

    movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);

}

void FixedUpdate () { 

    // If the players movement Vector doesn't equal zero...
    if (movement != Vector3.Zero) {

        //...then create a target rotaion based on movement Vector...
        Quaternion targetRoation= Qauternion.LookRoatation(movement, Vector3.up);

        // and create another roatation that moves from the current rotation too the target rotation...
        Quaterion newRoataion = Quaternion.Lerp (playerRigidbody.rotation, targetRoataion, turningSeep * Time.deltiaTime)

        // and change the Player's rotation too the new incremental rotation...
            playerRigidbody.MoveRoation(newRotation);

        // then play jump animation
        playerAnimator.SetFloat ("Speed", 3f);
    } else {
        // Otherwise don't play jump animation
        playerAnimator.SetFloat ("Speed", 0f);

}

Randy Eichelberger
Randy Eichelberger
445 Points

There's several places in your code where you don't have the proper words or the capitalization isn't correct. Make sure you're paying close attention to exactly what is written. I don't know personally if it will solve the issue but I do know that you will have issues the way things are.

The best way to do it is to pause on the video and read the code backwards. From the bottom to the top, right to left. This is one of the best ways to debug your code because your brain will start autocompleting things in your head and make things look correct when going the right way, but going backwards you have to pay closer attention thus you don't have that issue.