• Advertisement
Sign in to follow this  

How to draw a weapon in a fps

This topic is 1838 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

So what would be the best way to show a weapon in a first person game?

Should I just translate a weapon model wherever the camera goes?

Share this post


Link to post
Share on other sites
Advertisement

You don't need to translate to the player position. Use a special camera that is located at the origin and draw the 1st person model there too.

Most games also clear the z buffer before drawing the hand model and set the projection matrix near/far values very close to the camera to get more precision and prevent the gun from sticking into walls and objects.

You can even experiment with the projection's fov, sometimes it looks good to choose a different fov for the 1st person model.

Share this post


Link to post
Share on other sites

You could do it as you have described, or just set the view matrix to be identity and render the model only in object space.  That would position it relative to the camera, without doing the extra translation (they will likely be equal in performance, so it really is just your preference).

 

Have you tried doing one way or the other yet, or are you just getting ready to try it out?  I would suggest trying both ways and see how they work in your engine, and then also see how flexible your engine is - can you support doing it either way?  Is it a data driven solution, or is it all hard coded?  I always try to push myself to make things configurable enough that solutions can be added later on, allowing for easy extensibility as you go!

Share this post


Link to post
Share on other sites
this was just a question that came in my mind.Untill I get to that point with my engine...well..it's gonna take some times,I have a lot of stuff to implement.

Share this post


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

  • Advertisement