Jump to content
  • Advertisement
Sign in to follow this  
Meshboy

Position of gun to center of screen.

This topic is 3319 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 am building a FPS and i need a good formula on how to get the distance from the right-bottom screen to the center screen and far away (z-value) by 100. What i am trying to acheave is a path for my particles to go when firing my weapon. when rotating and looking around all my attempts formulas are not performing 100% same results...

Share this post


Link to post
Share on other sites
Advertisement
If I understand your question correctly, you will need to 'unproject' your window coordinates back into world space.

OpenGL and DirectX both have utility functions that will help you do this: glUnproject and D3DXVec3Unproject, respectively.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!