This repository has been archived on 2026-01-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
AW_2025/Assets/Scripts/Util/Rotatable.cs
2025-02-24 15:18:12 +09:00

18 lines
458 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Rotatable : MonoBehaviour
{
float rotateSpeed = 20;
void OnMouseDrag()
{
float rotateX = Input.GetAxis("Mouse X") * rotateSpeed * Mathf.Deg2Rad;
float rotateY = Input.GetAxis("Mouse Y") * rotateSpeed * Mathf.Deg2Rad;
transform.RotateAround(Vector3.up, -rotateX);
transform.RotateAround(Vector3.right, rotateY);
}
}