Question about RayCasting

rajesh_kumar 101 Dec 23, 2009 at 04:54

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.


3 Replies

Please log in or register to post a reply.

Reedbeta 167 Dec 23, 2009 at 17:36

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 101 Dec 24, 2009 at 10:05

Hi Reedbeta Thanks a lot

Wernaeh 101 Dec 25, 2009 at 14:06

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.

- Wernaeh