So I wrote some code to make an object rotate if I swiped left or right
`
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Rotater : MonoBehaviour {
public Transform player;
void Update()
{
if (Input.touchCount == 1)
{
// GET TOUCH 0
Touch touch0 = Input.GetTouch(0);
// APPLY ROTATION
if (touch0.phase == TouchPhase.Moved)
{
player.transform.Rotate(0f, 0f, touch0.deltaPosition.x);
}
}
}
}
`
and the problem is when I swipe fast the rotation will be uncontrollable. So I want the input to be less sensitive.
my goal is for the rotation to be like rolly vortex
my setup:
(watch for context: - YouTube)
-
I made an empty object and put it in the center
-
made the empty object a parent of my player
-
and finally, I put my code in the empty object
this setup made the player rotate in sort of an orbit which like I told you is similar to rolly vortex.