我有一个脚本,当您单击它时,它会使对象旋转。我想看看添加 iTween 是否会改善运动,但我应该在哪里添加呢?
iTween 代码:
iTween.RotateBy(gameObject, iTween.Hash("x", .25, "easeType", "easeInOutBack", "loopType", "pingPong", "delay", .4));
脚本:
using UnityEngine;
using System.Collections;
public class rotate : MonoBehaviour {
public float minX = -360.0f;
public float maxX = 360.0f;
public float minY = -3660.0f;
public float maxY = 360.0f;
public float sensX = 500.0f;
public float sensY = 500.0f;
float rotationY = 0.0f;
float rotationX = 0.0f;
void Update () {
if (Input.GetMouseButton (0)) {
rotationX += Input.GetAxis ("Mouse X") * sensX * Time.deltaTime;
rotationY += Input.GetAxis ("Mouse Y") * sensY * Time.deltaTime;
rotationY = Mathf.Clamp (rotationY, minY, maxY);
transform.localEulerAngles = new Vector3 (rotationY, -rotationX, 0);
}
}
}