Debugging help needed

Hello, i have a variable this.targetPosition that switch back to old value, i have tried to find the reason, but in the code i see nothing (there are few lines with that so it’s easy to track). The problem is when i attack an enemy and when engaged try to flee the variable is changed, and on the second update point again on enemy. this is the code https://playcanvas.com/editor/code/352037/player.js and this is the project https://playcanvas.com/editor/scene/396696 (i have enabled the enemy so you just need to attack it and then try to flee)

Line 947, is this deliberate?

            if(this.state === "walking" || this.state === "run") {
                if (this.target) {
                this.targetPosition=this.target.getPosition();
                }

Should this not be:

            if(this.state === "walking" || this.state === "run") {
                if (this.target) {
                this.targetPosition.copy(this.target.getPosition());
                }

yes @yaustar…i have read the code tens of time and didn’t noticed…thanks a lot