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

Shane Singh
Shane Singh
5,440 Points

Quaternions in first person?

Hello everyone, I am focusing on making first person games. I just wanted to know how would you go about programming the camera to go in first person of the frog instead of third person? I remember earlier in this course of Nick briefly touching on the subject and it got me interested! I greatly appreciate the on going support from the community, thank you guys!

Cheers,

Shane

2 Answers

John Steer-Fowler
PLUS
John Steer-Fowler
Courses Plus Student 11,734 Points

Hey Shane,

I am new to Game Development, so I might be wrong here.

I would have thought that you need to position the camera just inside or in front of the player in order to get the effect of first person. Either that, or if it is possible to control the camera as though you are controlling a player.

In Nick's course, we position the camera above the player, looking down. You need to adjust the Vector3 to have less on the y-axis.

This might already seem obvious to you. Like I said, I am new to Game Development. I am trying to help the best I can, because this is a new course on Treehouse and there are not many experts around yet :D

Keep up the good work

I agree with John Steer-Fowler (in addition you'd need to rotate the camera to be forward facing and also child it to the main frog gameobject and disable or delete the camera follow script), but you may want to consider the design implications a bit. The main thing that comes to mind is what is intuitive from a control point of view for first person. You wouldn't want to have left and right turns as fast as we have in Nick's demo, it's would quickly make you feel dizzy. But then maybe you do want that and that adds to the "hectic drama". There are many many ways of doing first person depending on the game and really down to personal preference of your design direction. Do you want mouse rotation, fixed rotation along axes, keyboard only input...? No way is better than another they just have different approaches depending on what you want to achieve so it's just some higher level thinking on how you want it to feel moving as the frog. You may even want to try pulling in the first person prefab (included in Unity standard assets) and using that as the camera instead (attaching the frog's scripts to it).