How to fire a ray? (Raycasting in 2D) [SOLVED]

Looking for a fast way to fire a ray from one object forward to see how far away the object in front of it is. Tried a few times myself but couldn’t get it working at a speed anywhere near what I’d need for a game.

Cheers :grin:

10 Likes

I have a project that is kind of like this, Idk if it’s what you want.


Yes it is really laggy, but it is doing multiple lines.

6 Likes

Ray for rayquaza?

5 Likes

Na for raycasting probably for kind of sight of light rendering which is what I used it for

5 Likes

Could you send a link to the project? Then we can check your code so we can improve it.

6 Likes

I’m going to try doing a thing later so maybe I could help

4 Likes

What object is sending the ray?
Does the ray need to rotate?
Is there multiple objects the ray needs to look for?

5 Likes

Yes the ray needs to be able to hit a variety of objects. As for what object is sending the ray idk how I would describe that, it’s an ai that I want to pathfind around a level

6 Likes

ooh I see your idea! seems awesome!

2 Likes