简单旋转缩放代码
using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraControl : MonoBehaviour { // 主角 public Transform target; // 缩放系数 private float distance = 5.0f; // 左右滑动移动速度 private float xSpeed = 250.0f; private float ySpeed = 120.0f; // 缩放限制系数 private float yMinLimit = -20; private float yMaxLimit = 80; // 摄像头的位置 private float x = 0.0f; private float y = 0.0f; // 记录上一次手机触摸位置判断用户是在做放大还是缩小手势 private Vector2 oldPosition1 = new Vector2(0, 0); private Vector2 oldPosition2 = new Vector2(0, 0); Vector3 offset; //初始化游戏信息设置 void Start() { Debug.Log(oldPosition1); Vector3 angles = transform.eulerAngles; x = angles.y; y = angles.x; if (target == null) { target = GameObject.FindWithTag("Pl
游戏开发-物体对象简单旋转缩放代码
最新推荐文章于 2024-03-06 10:47:53 发布