Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | 5hoT0 |
Hi everyone !
I have been trying to deal with an a* path finding script based on a grid that I found on this video, the script was originally made on a Spatial node and I tried to translate it on 2D Node, but after 2 hours of debugging I’ve been stuck for a while with this error :
Invalid call. Nonexistent function 'begin' in base 'Node2D (drawPath.gd)
This error call me back to the line marked with an # :
func drawPath(path):
var d = get_node("drawPath")
d.clear() #
d.begin(Mesh.PRIMITIVE_LINE_STRIP, null)
for p in path:
d.add_vertex(Vector3(grid[p].center.x*cell_size,0,grid[p].center.z*cell_size))
d.end()
I did some research on my own and I think it’s mainly because it tries to treat the get_node as a common object.
The draw_path.gd script that is called is in the same directory and attached to a children Node2D.
If you want to have more precision please feel free to ask,
PS : The original code was made in a Godot 2.2 engine or older, it’s maybe a compatibility problem I guess ?