Jump to content
  • Advertisement
Sign in to follow this  
bzroom

First Person Shooting

This topic is 3993 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 thinking about adding a first person view to my shooter. The problem I don’t understand is the offset between the view vector and the shoot vector coming out of the barrel of the gun. In my shooter the gun will by slightly offset (it’s a hand gun but soon will support a rifle) between the look vector and the shoot vector. I was wondering how most FPS games deal with this. Do they just shoot the bullet down the view vector? How else could you ensure that the bullet’s trajectory will intersect what ever is inside the crosshairs? I was thinking if the gun was close to your face like a rifle with a scope, shooting out of the look vector would not be that noticeable. But if the gun is a pistol, or a gun held down to your side (like a pistol grip shot gun), the difference may be much more noticeable. The problem is if I look from one vector and shoot from another, the bullet is not necessarily going to intersect the crosshair (except for at one calibrated distance). Any suggestions? Feel free to try the game here. (Opengl 2.0 highly recommended)

Share this post


Link to post
Share on other sites
Advertisement
There are many possible solutions to the "FPS problem", and which one you use is simply a matter of taste; since, in practice, it's not a major issue if the projectile trajectory and the view vector intersect at the right point, or even fail to intersect at all.

For example, in Metroid Prime, they implemented two targeting modes, free and locked. When free-targeting, the projectile is fired from the gun in the direction of the view vector; most objects are sufficiently large that the offset between viewpoint and firing point are largely inconsequential. When locked onto a specific target, however, all projectiles are fired along the vector from the firing point to the target, thus ensuring that the target will be it regardless of how small or far away it is, provided it doesn't move very much in the time it takes the projectile to reach it.

Another option, if one doesn't wish to use some kind of target-locking system, is to basically treat it as a modified picking problem. Essentially, use the crosshairs to determine which object is being targeted, estimate the collision point between the object and the viewpoint-crosshair ray, and then fire the projectile along the vector from the firing point to the estimated collision point.

Or you could just fire the projectiles in the view direction, and put it onto the player to realize that the are going to have to offset their aim to his a specific point.

Share this post


Link to post
Share on other sites
Thanks Anthony Serrano, you basically mentioned all the solutions I could come up with. I already have an automatic targeting system and I wanted to implement a free first person shoot. So I guess I'll just lock the camera onto the head movement and shoot the gun in the same direction. In 3rd person you'll literally pick objects and shoot at them with some random error.

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!