0 votes

Can somebody tell my what's wrong with this?

func Get_Target():
    var target: Vector3 = ai_path.get_child(ai_current_pos).position
    return target

It says: Invalid get index 'position' (on base: 'Position3D').

I don't know why it returns null, the variable aipath is a reference to the path root node ("../AIPath") and the getchild should get the first child since the variable aicurrent_pos is set to 0;

Node Tree:
(Root) World
    - ...
    - AI_Path
         - Node1
         - Node2
in Engine by (99 points)

are you SURE ai_current_pos is 0?

yep, but i think i solved my problem using translation instead of position.

1 Answer

0 votes
Best answer

The error states -> there is no property position in the object of type "Position3D"

Use the property translation wich is implemented in Spatial wich Position3D extends from.

by (4,088 points)
selected by
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.