iOS Rotation Chararacter with joystick

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? :slight_smile:

Hey, this work for me.
I hope than for you too.


 if (pp_joystickForLook.position.x != 0 || pp_joystickForLook.position.y !=    0)
               {
                   // Scale joystick input with rotation speed
                   var camRotation = pp_joystickForLook.position;
                   camRotation.x *= rotationSpeed.x;
                   camRotation.y *= -rotationSpeed.y;
                   camRotation *= Time.deltaTime;
       
                   // Rotate around the character horizontally in world, but use local space
                   // for vertical rotation
                   transform.Rotate(0, camRotation.x, 0, Space.World);
                   transform.Rotate(camRotation.y, 0,   0);
               }