Raycast Hit output very inaccurate

I made a working laser, but it’s off. The raycast it uses to find the distance is somehow always showing the same distance through the same block even if though it is changing the angle. ’

For better show: If I hit a block under me at a 85 degree angle, it will appear to be further than if i hit it at a 90 degree angle.

It doesn’t do that, it just shows an inaccurate result. If I had a more accurate distance I could also attempt to find the position with an addon to raycast, but I don’t have that.

2 Likes

This is because it outputs the distance to the center of the object and not how far the ray traveled. This is pretty annoying so I hope grazer adds an option to output the distance it traveled.

2 Likes

Since it’s to the center of an object, could it be possible to decrease the distance of the laser by 16 pixels? Since it’s half of a grid space it could be more accurate instead of it going straight to the center.

2 Likes

That won’t work, the measurements are to the center of the object, not where the laser hit the object.

2 Likes

Because we know the angle of the ray and we know the distance of a straight line to the center of the object, should we be able to find the length of the hypotenuse? I’m really rusty on my cos sin and tan so I don’t remember the exact equations off the top of my head.

2 Likes

I’ve already basically done that with an addon, but i still need raycasts since mine needs positions.

1 Like

What do you mean by position?

The addon I made can’t calculate like a raycast since it isn’t a physical object. It’s just math, so you need to put a position into it for it to calculate.

1 Like