Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to draw a weapon in a fps


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 noatom   Members   -  Reputation: 759

Like
0Likes
Like

Posted 07 January 2013 - 05:26 PM

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?

Alexander Turda - The place where I talk about games, coding, movies, and whatever passes through my mind.


Sponsor:

#2 Madhed   Crossbones+   -  Reputation: 2452

Like
1Likes
Like

Posted 07 January 2013 - 05:43 PM

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.



#3 Jason Z   Crossbones+   -  Reputation: 4571

Like
0Likes
Like

Posted 07 January 2013 - 08:55 PM

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!



#4 noatom   Members   -  Reputation: 759

Like
0Likes
Like

Posted 08 January 2013 - 04:20 AM

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.

Alexander Turda - The place where I talk about games, coding, movies, and whatever passes through my mind.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS