math & physics
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.
That's an interesting question. Different FPS games have done it different ways. It's more "realistic" to take the line of fire from the weapon, but this means the shot will sometimes be blocked by obstacles and won't reach the crosshair, which can be annoying for players. So it comes down to a design decision. You should try out both ways and see which one you like better.
You can also use a combination of both - place the shooting center at the weapon tip, but place the camera a little lower, somewhere above the stomach instead of at the head.
Pro: Shooting line and crosshairs in the HUD match.
Con: You lose some feeling of control - for instance, you'll not be able to look over cover that your head actually sticks out of.