Problem with Raycast in First Person

  1. What do you want to achieve?
    I am trying to have raycast to work in Third and First person.

  2. What is the issue?
    If I am in first person the raycast will hit an accessory on the player, I am wanting to figure out how disable the raycast hitting the player while only in first person, not third person.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Ive tried looking around but I havent seen much with specifically having the raycast in the player in 3rd person but disable while in 1st person.

If you want clarification on something just ask, I know that was hard to read.

1 Like

You can detect if a player is in first person by checking if the distance between their head and their character is < 0.5 studs.

2 Likes

Im not really having an issue detecting when the camera is first person. Its how to disable the raycast from hitting the players accessories once in first person.

You can create a RaycastParams object and add it to the raycast.

4 Likes

Yep, I used exclude RayCast function and ended up getting it to work.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.