Jump to content
  • Advertisement
Sign in to follow this  
markookram

Different ways of building a FPS style camera

This topic is 3917 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to create a FPS style camera with Direct3D in C#. Have seen millions of tutorials, but they are all pretty much the same or give you only one part of the code and I can't figure it out. Most tutorials I have seen is with the Matrix.LookAtRH function which requires camera position AND camera target. Why the need for a target in a 1st person camera? Is there a way of setting up a camera without it? Something that would just have the camera movement and control the yaw/pitch/roll.

Share this post


Link to post
Share on other sites
Advertisement
Here you can find some code that uses a different approach (the files for part 3, chapter 12). It's part of a book's source code.

BTW, that book has a second edition, but it's implementation is different and seems more limited.

Share this post


Link to post
Share on other sites
Whenever I've done a FPS camera I've always stored the up, forward and right vectors and generated a view matrix from that (easy - you just have to shove them into a 4x4 matrix in the correct position and pad the rest out). For actual movement you can construct a 4x4 matrix and apply it to all the vectors. Eg. if you were turning left you'd make a rotation matrix around the 'up' vector for your turn amount and apply that.

Share this post


Link to post
Share on other sites
Probably the easiest way to fix that is to create a new project and link the appropriate libraries.

Share this post


Link to post
Share on other sites
Just did that, removed the DirectX references and added them again. It runs in full screen, but nothing happens, just a blank light orange colored screen.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!