Portal belajar membuat aplikasi Augmented Reality dan Virtual Reality

Rabu, 23 November 2016

Rotation GameObject by Touch

23.43 Posted by Dicky Rachmat Iskandar No comments

using UnityEngine;
using System.Collections;

public class Rotasi : MonoBehaviour
{
 
    float rotSpeed = 1000;

    void OnMouseDrag()
    {
            float rotY = Input.GetAxis("Mouse X") * rotSpeed * Mathf.Deg2Rad;
            transform.Rotate(0, 0, -rotY, Space.Self);
             float rotY = Input.GetAxis("Mouse Y") * rotSpeed * Mathf.Deg2Rad;
            transform.Rotate(0, -rotY, 0, Space.Self); 
    }

}

0 komentar:

Posting Komentar