Does the 'thinckness' of Raycasts matter?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Skydome

So in my game vertical vs horizontal has some minor differences. In vertical combat the melee strikes have a wider range. In horizontal the range is longer.
So I need a wider detection range in vertical movement for player detection. Will increasing the raycast scale be enough for horizontal movement?

:bust_in_silhouette: Reply From: DaddyMonster

Raycasts have no thickness. It’s a test for collisions on a line from vector A to vector B (from the raycast’s origin to the cast_to vector).

You haven’t shared your code but probably you just need to normalise the cast_to vectors and then multiply it by a scalar.

Something like this: cast_to(Vector3(1, 2, 3).normalized() * ray_length) That’ll preserve the direction and allow you to control the length.

Thank you. This really helps me out.

Skydome | 2022-06-10 16:56