0 votes

I'm a noob at programming so I don't know how to draw sth like thisimage

So I created this script

func _ready():
    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)

Godot version 3.2.3
in Engine by (31 points)
edited by

Don't understand why the image is not showing, go here instead : Image

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?

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.