I am having an issue i cannot seem to figure out within my code. What this code does at the moment is that it rotates the 3D Model around the z axis but i need it to rotate around the y axis. Any help would be greatly appreciated.
void Update ()
{
Vector3 moveVector = (Vector3.up * joystick.Horizontal + Vector3.left * joystick.Vertical);
if (joystick.Horizontal != 0 || joystick.Vertical != 0)
{
transform.rotation = Quaternion.LookRotation(Vector3.forward, moveVector);
}
}
Quaternion.LookRotation(moveVector, Vector3.up);
? \$\endgroup\$ – Alex F Mar 24 '19 at 4:15moveVector
can be parallel to the vertical axis at the moment. I'm not sure if they meant to multiplyjoystick.Horizontal
byVector3.forward
instead ofVector3.up
... \$\endgroup\$ – DMGregory♦ Mar 24 '19 at 12:03