你能试试 SmoothLookAt 或 transform.LookAt 吗?您可以将两者都放在相机上,并将您的电路板指定为“目标”。你也可以做一个 iTween 让它看起来你正在平滑地看着一个指定的目标。
private var target : Transform;
var damping = 6.0;
var smooth = true;
@script AddComponentMenu("Camera-Control/Smooth Look At")
function LateUpdate () {
if (target) {
if (smooth)
{
// Look at and dampen the rotation
var rotation = Quaternion.LookRotation(target.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
}
else
{
// Just lookat
transform.LookAt(target);
}
}
}
function Start () {
// Make the rigid body not change rotation
if (target == null)
target = GameObject.Find("Board_Name").transform;
if (GetComponent.<Rigidbody>())
GetComponent.<Rigidbody>().freezeRotation = true;
}
有了 iTween,你可以使用
iTween.MoveUpdate(gameObject, iTween.Hash("position",board.position,"time",2));
iTween.LookUpdateModified(gameObject,iTween.Hash("looktarget",board.position,"time",2));
您还可以使用其他一些相机脚本。
不久前我还做了一个鼠标平移缩放类型的脚本。请记住 minZoom 和 maxZoom 必须在 0 到 180 之间,但您可以使其更精细,将其附加到相机,您可以使用滚轮进行控制。我也有用于缩放和移动的触摸脚本。这将允许您放大和缩小。:
if (Input.GetAxis("Mouse ScrollWheel")!=0) {
camera.fieldOfView += Input.GetAxis("Mouse ScrollWheel");
camera.fieldOfView = Mathf.Clamp(camera.fieldOfView, minZoom, maxZoom);
}