This script will cast a ray from one position to either another position or towards a direction.

It currently only supports rectangles

It will give you all information you need regarding the ray cast:

  • Start position
  • Hit position
  • Direction
  • Object hit
  • Normal of face hit
  • Angle of reflection
  • Distance to hit

Works with all rectangles, both scaled and rotated. Be aware that the rectangle needs precise collision mask to be able to ray cast correctly when rotated. On non-rotated rectangles, the regular rectangle collision mask works perfectly fine. Note that if the rotation is divisible by 90, regular rectangle collision mask also works.

ray_cast(startPosition, endPosition or direction, object, precise, notMe, [maxDistance])

End User Licence Agreement (EULA).

Changes in 1.0.2

Fixed a bug in that precise and notMe arguments where mixed up

Version 1.0.2. Published March 4, 2017

Age Rating: 4+

Average Rating

This asset hasn't received enough reviews yet.

Your review

You can only review assets you've bought.

No reviews yet

No reviews have been left for this asset - be the first!

What is the issue?

Back to Top