Code (CSharp): moveDirection = transform.TransformDirection(moveDirection); moveDirection = (target - transform.position).normalized; moveDirection.y = 0; float myDirection = transform.rotation.y; Vector3 vectorDirection = Quaternion.Euler(0, myDirection, 0) * moveDirection; //moveDirection = transform.TransformDirection(Vector3.right); playerMove.MovePlayer(vectorDirection.x, vectorDirection.z); need to convert direction based on current player rotation like that: Code (CSharp): moveDirection -= transform.rotation.y
transform.rotation.y doesn't mean what you think it does and you basically shouldn't use it under any circumstances ever (transform.rotation is a Quaternion, and the w/x/y/z parameters of a Quaternion have nothing directly to do with the x/y/z axes). You are probably thinking of transform.eulerAngles.y, though using that is still rather fraught. If your goal is to get the direction directly behind the player, you should probably be using -transform.forward instead.