0 votes

I have some code to move a kinematic body 2d along an AStar path,
the body is provided with the path points as a Vector3 which is how AStar handles them.
I would expect the character to move to the right, however it pretty much always looks off in the wrong direction and heads towards the top left corner.
What am i doing wrong...

var moveSteps = [Vector3(60,0,120),[Vector3(90,0,120),[Vector3(120,0,120),[Vector3(150,0,120),[Vector3(180,0,120),[Vector3(210,0,120)]
var nextMoveStep = Vector3(30,0,120)
func _physics_process(delta):
    var pos = nextMoveStep
    if isMoving:
        var vel = Vector2(1,0)
        var posV2 = Vector2(pos.x,pos.z)
        print("to Pos: "+str(posV2))
        print("CurrPos "+str(position))
        var rot = rotation
        vel = vel.rotated(rot)
        vel = vel * speed
in Engine by (201 points)

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.