Problem with vector and charactercontrol

I have a CharacterControl, and I want to obtain a position that is “in front” of the CharacterControl itself and advanceAmount away.

According to my tests, I get random results.
I am uncertain whether the code below is conceptually wrong, or if some randomness is to be expected because the current position of control is determined by physics (the terrain is not flat, therefore the control itself is always moving)

Code:

CharacterControl control;
Vector3f goal;
Vector3f lookingFor;

    public void advance(float advanceAmount){
        lookingFor=new Vector3f();
        goal.x=control.getViewDirection().x;
        goal.y=control.getViewDirection().y;
        goal.z=control.getViewDirection().z;
        //Quaternion q=new Quaternion();
        //q=q.fromAngleAxis( rotationY, Vector3f.UNIT_Y );
        //q.mult(goal,goal);
        goal.mult(advanceAmount,goal);
        lookingFor=control.getPhysicsLocation().add(goal);
    }

I’ve commented out the Quaternion stuff (which was supposed to rotate the vector around the Y axis).
Thanks!

This should work (you can even use. GetviewDirection.mult(advanceamount))

The thing is, as you said there are physics involved so it might change a little.
I’ve noticed that when I use setWalkDirection that i get a bit off, so I correct that if I’m too far from my path

If you however want to scan if something is infront of you, rathee use some cone (like a viewfield)