Sign in to follow this  
rajesh msen

question about RayCasting

Recommended Posts

hi Guys, I am trying to do a First Person Shooting game.I wants to know the shooting mechanism involved in a FPS game.I heard about raycasting.But i have one doubt whether i have screen's center position as a starting position of ray or i will take weapon position as a starting poistion of ray. Anyone please suggest me any articles or Thread.Thanks in advance. ---Rajesh---

Share this post


Link to post
Share on other sites
If possible the bullets need to go where the player is aiming them, and that implies they need to move along the same vector that the aiming crosshair is over(presumably the view vector). If the bullets will be slow and visible (like rockets for instance) and it isn't acceptable to have them apparently spawning from the heads of players then the problem is somewhat more interesting. I don't know how the pros do it but I can think of three potential solutions:

1. Shoot the rocket from the weapon in the direction of the aiming vector. It won't go exactly through the point that is aimed at, but hopefully the weapon and head are close enough together that it doesn't matter.

2. Have the rocket spawn from the players weapon and briefly move along a slightly curved path until it's position and direction coincide with the aiming vector.

3. Project the aiming vector into the scene and find the nearest point where it hits something. Then have the rocket spawn from the weapon and move towards this point.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this