using UnityEngine;
public class DragTest : MonoBehaviour
{
Vector3 scale;
float offset=0.2f;
float maxSize=2.0f;
float minSize = 0.4f;
public float speed = 200f;
// Use this for initialization
void Start()
{
scale = this.transform.localScale;
}
// Update is called once per frame
void Update()
{
//鼠标滚轮的效果
//Zoom out
if (Input.GetAxis("Mouse ScrollWheel") < 0)
{
if (scale.x <= maxSize)
{
scale.x += offset;
scale.y += offset;
scale.z += offset;
this.transform.localScale = scale;
}
}
//Zoom in
if (Input.GetAxis("Mouse ScrollWheel") > 0)
{
if (scale.x > minSize)
{
scale.x -= offset;
scale.y -= offse
unity鼠标左键拖拽旋转模型滚轮放大缩小模型
最新推荐文章于 2024-05-26 08:45:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)