Hello, I have a problem with rotation of Vector3 that used to be direction for NavMeshAgent in 2D game.
In my case, I wanna make Vector3.MoveToward + y Axis offset(that Evaluated by AnimationCurve) for easy customizable movement patterns. And it’s work, but I have one problem - I am struggle with rotation of yOffset relatively of Vector3 direction to player. I’ve tried 1)Vector3.Project + Quaternion.Euler and 2)ProjectOnPlane
It is work, but in 1 - Project case, when player move strict on xAxis and bendDirection becomes parallel to it, rotata = zero → bendYOffset = zero.
In 2 - ProjectOnPlane case same thing, but on yAxis.
I understand that the problem is overlap of bendDirection and Projections = zero.
But i dunno how to fix it properly.
Appreciate any help and advices.
PS. I am newbie in coding, if you think that this method of movement script = shit, please share you opinion.