- Home /
Question by
rakstar007 · Oct 11, 2021 at 12:33 PM ·
unity 2dunity remoteunity android
how to smoothly rotate my player in unity 2d android
i use fixed joystick from unity joystick Pack i have a spaceship which i rotate using this Fixed Joystick but the rotating is very snappy and not smooth at all ,ive heard we can use something called slerp but i have no idea how to use it
using UnityEngine;
using System.Collections;
public class move : MonoBehaviour
{
public Joystick joystick;
void FixedUpdate()
{
Vector3 moveVector = (Vector3.right * joystick.Horizontal + Vector3.up * joystick.Vertical);
if (joystick.Horizontal != 0 || joystick.Vertical != 0)
{
transform.rotation = Quaternion.LookRotation(Vector3.forward, moveVector);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Unity Editor not installing from unity hub.,Unity Editor is not installing from unity hub. 0 Answers
Unity Remote 5 android doesnt work.,Unity Remot 5 android doesnt work 2 Answers
I have this problem when I restart my game in Unity, bunch of gameObject spawns at once 1 Answer
I can't make drag and drop system work. 0 Answers
Lag on Unity Remote but no on computer, 0 Answers