Jump to content


- - - - -

Question about RayCasting


3 replies to this topic

#1 rajesh kumar

    Member

  • Members
  • PipPip
  • 30 posts

Posted 23 December 2009 - 04:54 AM

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---

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 5307 posts
  • LocationBellevue, WA

Posted 23 December 2009 - 05:36 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 rajesh kumar

    Member

  • Members
  • PipPip
  • 30 posts

Posted 24 December 2009 - 10:05 AM

Hi Reedbeta Thanks a lot

#4 Wernaeh

    Senior Member

  • Members
  • PipPipPipPip
  • 368 posts

Posted 25 December 2009 - 02:06 PM

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.

Cheers,
- Wernaeh
Some call me mathematician, some just call me computer guy. Yet, I prefer the term professional weirdo :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users