RayCasting

  • RayCasting

A RayCast is an invisible Ray that detects colliders

Origin of a Ray is a point in the space

Origin is stored as a vector 3 with x, y, and z position.

Second Vector 3 to store direction.

You can use Ray Variable as it stores 2 vector 3’s

RayCastHit hitInfo stores info on colliders hit

you can also add floats like distance (to define length of the ray) and Layer mask for objects that you want the ray to ignore (if its put on a specific layer)

If statement for collision with environment tag

Leave a Reply

Your email address will not be published. Required fields are marked *