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

Julie Ragnarsson
Julie Ragnarsson
3,320 Points

The frog gets stuck if it leaves the camera's view!

When in game mode, if I make my frog hop out of view of the camera it becomes uncontrollable. While stuck, the frog's position coordinates show that the x and z continuously fluctuate (but not by a full hop) even when not given keyboard input. Its rotation's y coordinate also freaks out. Half of the screen will sometimes become darker too. However, this is only a problem when it hops off the left or bottom side of the camera. If it hops out of view on the top or right side, it acts like Nick's frog and can still be controlled as normal. This happens whether the camera is zoomed in, or zoomed out.

I have checked my Main Camera settings in the inspector and they are the same as Nick's and I can't find anything wrong with my code. Can anyone tell me what's going on?

Mark VonGyer
Mark VonGyer
21,215 Points

If it is outside the camera view, how can you be sure what the frog is or is not doing :)

1 Answer

Julie Ragnarsson
Julie Ragnarsson
3,320 Points

To Mark I can tell the frog is getting stuck because I look at his XZ coordinate :)