I have been struggling to use the analog stick to set my character’s rotation. The solution below does not appear to work as it is dependent on the direction of the camera, which does not produce the result I want (character facing the direction of the analog stick.)
Is there another way to do this and achieve the result I want, or am I missing something?
I do not want to rotate the character in the direction of movement, it needs to be in the direction of the analog stick.
Thanks in advance for any advise.
Bump, still stuck on this.
get the current value of the controller stick X axis, this will be between -1 and 1
same for the Y axis.
now you can multiple these values by the forward and right vector of whatever direction you want
so if for example you were using the camera direction (i know you said you wern’t but easiest example to explain)
Get the forward vector of the camera, this will give you a direction vector between 0 and 1. Multiple that by the your Y axis value…so if you’re pressing up on the stick it will be 1 x 1 = 1, if you’re pressing down on the stick it’ll reverse the vector to be -1, i.e backwards. Store this value.
Do the same again for the X axis by getting the right vector of your camera direction. Store this value.
then create a vector using those two variables but zero out the Z axis i.e.
vector(Stored Value X, Stored Value Y, 0.0)
you should now have a vector that matches up with the way you’re pressing your analogue stick relative to a direction.