标签:-o new pre get inpu vector 旋转物体 nbsp world
using UnityEngine; public class RotateObj : MonoBehaviour { public float OffsetX = 0; public float OffsetY = 0; public float speed = 6f;//旋转速度 void Update() { if (Input.GetMouseButton(0)) { OffsetX = Input.GetAxis("Mouse X");//获取鼠标x轴的偏移量 OffsetY = Input.GetAxis("Mouse Y");//获取鼠标y轴的偏移量 transform.Rotate(new Vector3(OffsetY, -OffsetX, 0) * speed, Space.World); } } }
using UnityEngine;public class RotateObj : MonoBehaviour{ public float OffsetX = 0; public float OffsetY = 0; public float speed = 6f;//旋转速度
void Update() { if (Input.GetMouseButton(0)) { OffsetX = Input.GetAxis("Mouse X");//获取鼠标x轴的偏移量 OffsetY = Input.GetAxis("Mouse Y");//获取鼠标y轴的偏移量
transform.Rotate(new Vector3(OffsetY, -OffsetX, 0) * speed, Space.World); } }}
标签:-o new pre get inpu vector 旋转物体 nbsp world
原文地址:https://www.cnblogs.com/Transmuter/p/11074539.html