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

code
raycasting
hopscotch-help
#1

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:

7 Likes
#2

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.

3 Likes
#3

Ray for rayquaza?

3 Likes
#4

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

3 Likes
#5

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

3 Likes
#6

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

2 Likes
#7

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

3 Likes
#8

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

5 Likes
#9

ooh I see your idea! seems awesome!

1 Like