Question by 
               wassim-s-haddar · Mar 07, 2019 at 10:44 PM · 
                rotationinputmobiletouch controls  
              
 
              I'm having trouble rotating a game object by dragging screen using touch input
I'm having trouble rotating a game object by dragging screen using touch input
Code:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class GameControls : MonoBehaviour { public GameObject character;
 public float rotationSpeed;
 private void Update()
 {
     if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
     {
         Vector2 TouchPosition = Input.GetTouch(0).deltaPosition;
         character.transform.rotation = Quaternion.Euler(new Vector3(0, TouchPosition.x * rotationSpeed * Time.deltaTime, 0));
     }
 }
}
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                