![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Dully |
I’m a noob at programming so I don’t know how to draw sth like this
So I created this script
func _ready():
ray.resize(8)
for i in 8:
ray[i] = position + Vector2(1,1).rotated(i * PI * 2) * 100
func _draw():
for i in ray:
draw_line(position, i , Color(255,0,0),1)
(I’m trying to make my own avoiding obstacle AI without Navigation because I have already used normal pathfinding for my project)
I have researched a lot about this but I still don’t know why this doesn’t work, if you know how to fix this please tell me (Actually if you know a way to make the AI follow the player and avoiding obstacle at the same time without Navigation)
Don’t understand why the image is not showing, go here instead : Image
Dully | 2021-04-11 11:19
It’s looking like you’re rotating each element of ray by a multiple of 2pi radians (one full circle). From your picture you’d want to rotate each element by pi/4 so that you get 8 lines. Am I understanding you correctly?
nonfinity | 2021-04-13 20:41