To move player around I use lookRotation using a direction vector that has CurrentSpeedX,0,CurrentSpeedZ as components.
Those increase and decrease when the input axis are used. That makes the player only rotate 180 degrees when the X or Z component (depends on his direction) go all the way back to 0 and change sign.
And then I simply use transformtodirection on the camera to make the movements depend on the camera forward.
All this works great. The only issue im facing though is trying to push the player forward by changing the speed.
I want to make a sonic boost to be precise. But just changing the CurrentSpeedX and CurrentSpeedZ will make sonic go to the wrong direction cuz those won’t match his facing direction.
I noticed that by multiplying them by h and v (which are the horizontal and vertical axis ) will fix the issue.
But that wont do anything when they re not being pressed since their value is 0
So I wonder if there’s a way to calculate a value between -1 and 1 that will be then multiplied by the speed I want to add so the direction vector will always be facing sonic’s forward