Other uses for Raycast?

Forum Archive Other uses for Raycast?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #7049
    resin213
    Participant

      Is this what I would use if I wanted ‘open’ text to appear when a player was close to and looking at a container? Or is there a more commonly used choice for that, something like a mouse over if you were working in 2d?

      #26431
      Jonathan Gonzalez
      Participant

        Raycasts have a ton of uses. They just detect colliders, but you can use that information for a variety of purposes. Like you mentioned you could have a text element appear when you are looking at a specific object. Other ways of using them are to detect if you have direct line of sight to an object. For instance in an explosion I may want to use a raycast to detect what objects have direct line of sight to the explosion impact, if so we can apply damage. Anything not detected by a collider will not be damaged. 

        It’s also use for point and click type mechanics. I’m actually working on an updated version of this course called the “Game Programming Bootcamp” and will contain a few new examples of raycasts being used. 

      Viewing 2 posts - 1 through 2 (of 2 total)
      • The topic ‘Other uses for Raycast?’ is closed to new replies.