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

Jeanette F
Jeanette F
665 Points

Compiler errors on "Rotate the Player Towards the Target"

Getting compiler errors trying to run game. Not sure what to fix. Unless I'm blind, which is totally possible, I am not seeing anything different in my script compared to the video.

Errors:

  • Assets/Scripts/PlayerMovement.cs(43,109): error CS0103: The name `turningSpeed' does not exist in the current context
  • Assets/Scripts/PlayerMovement.cs(43,61): error CS1502: The best overloaded method match for `UnityEngine.Quaternion.Lerp(UnityEngine.Quaternion, UnityEngine.Quaternion, float)' has some invalid arguments
  • Assets/Scripts/PlayerMovement.cs(43,61): error CS1503: Argument #3' cannot convertobject' expression to type `float'

It all points to line 43 which is this code: Quaternion newRotation = Quaternion.Lerp (playerRigidBody.rotation, targetRotation, turningSpeed * Time.deltaTime);

Can anyone see what I've done wrong? I'm not a programmer and a bit lost here.

Thanks in advance,

Jeanette

2 Answers

Seth Kroger
Seth Kroger
56,413 Points

I think the relevant error is this: "The name The nameturningSpeed' does not exist' does not exist". It's likely you misspelled turningSpeed further up, but you can always post the whole script if that isn't the issue.

Jeanette F
Jeanette F
665 Points

Thank you Seth. That fixed it. I had turning.Speed referenced above. so the error was correct - turningSpeed didn't exist. Now I have no errors, but my frog isn't moving. Will go back to the videos and hopefully I can figure it out.