Description

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

Your review

You can only review assets you've bought.


Gravatar

Jesse L 12 May 2019

As close to perfect as possible

This is a very good raycasting script, but it has one problem that most users wont notice. If the ray is started from within the object the ray is checking for collisions for, it will take one step before it check for collision, as such rays started near the border of the colliding object on the inside will return either no ray collision, or a slightly off ray collision. It also could use some optimisation and a child 2 line intersection point script to give an ever so slightly more accurate raycast.

However as I said most users wont notice these things, and are very unlikely to cause any real problems. As such 5 stars.


Gravatar

Anonymous 17 April 2019


Gravatar

Mario V 19 December 2018

Worked perfectly as described!


Gravatar

Panayiotis Y 22 November 2018


Gravatar

Anonymous 12 August 2018


Gravatar

Anonymous 26 June 2018

works!

Package contents

Loading, please wait

What is the issue?

Back to Top