Hello everyone! I have a huge problem here… i have one last thing to do to finish the prototype and im stuck bad here…
I wanna the right joystick rotate the character depending the joystick’s position… and i cant figure out…i looked in unity answers but didn’t found much… the only close code i have is this one
var rotateJoystick : Joystick;
function Update()
{
if(rotateJoystick.position.x > 0 || rotateJoystick.position.y > 0) {
var rotationDirection = Vector3(rotateJoystick.position.x, 0 , rotateJoystick.position.y);
rotationDirection = rotationDirection.normalized;
var rotation = Quaternion.LookRotation(rotationDirection);
transform.rotation = rotation;
}
}
but still doesn’t work right… any help?