W
W
WeBBeW2020-12-27 07:37:13
Unity
WeBBeW, 2020-12-27 07:37:13

How can I make the beam ignore an object?

How can I make the ray ignore an object without using a layer?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GFX Data, 2020-12-27
@WeBBeW

Physics.RaycastAll() - get an array of hits of all objects that the ray "pierces", select the desired collider from the array, for example, by tag

RaycastHit[] hits;
hits = Physics.RaycastAll(transform.position, transform.forward, 100.0F);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question