Raycasting!

I made a rudimentary raycaster that can be used for more continuous collision
Syntax:

this.cast(slope,y-intercept,target,step size)

To calculate y-intercept:

this.y-(this.x*(slope));

To get slope from rotation:

slope=Math.tan(this.rotation/180*Math.PI)

The function will return the distance between the raycasts

If the raycast does not hit the target, it will return 0

Raycast11-2-2022_12-15-17.wick (3.0 KB)

potentially very interesting but I get errors as soon as it starts

Fixed it
Raycast11-3-2022_7-30-10.wick (3.0 KB)

Very very nice
Thankyou for sharing !!!

Note: The raycaster doesn’t require the line clip, but it’s pretty difficult to see if anything’s happening unless it’s there. All it uses is math, although if you do remove the line clip, it will break some things because that’s where the slope is defined, but it’s very easy to change the “m” variable again.