Questions about Raycasting?

which is what I’ve made but the resoult is this:

What you want to do is set the GROUND to a layer by itself, I call that layer “Ground”
Then the layermask only contains Ground

I got it! :grimacing:
It wasn’t working 'cause we miss a parameter here, so he was supposing that the layerMask was the maxDistance, indeed by adding Matf.Infinity is working fine.
bool hasHit = Physics.Raycast(GetMouseRay(), out hit, Mathf.Infinity, layerMask);

Now I will find a nice way to calculate a reasonable distance for the RayCast and this issue will be defintely closesd. :grin: :partying_face:

Thank you for the support, and sorry for the bother. :sweat_smile:

It’s definitely smaller than infinity. I would try somewhere between 50 and 200

1 Like

“Frickin’ laser beams!” Love the Austin Powers reference :joy:

Privacy & Terms