math & physics
rajesh_kumar at December 22nd, 2009 23:54 — #1
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.
reedbeta at December 23rd, 2009 12:36 — #2
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.
rajesh_kumar at December 24th, 2009 05:05 — #3
wernaeh at December 25th, 2009 09:06 — #4
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.