0
旋轉我用這與在Unity我的相機腳本遵循遊戲對象:如何獲得一個攝像頭周圍物體
using UnityEngine;
using System.Collections;
public class CameraMoverScript : MonoBehaviour {
public Transform mainCameraTransform = null;
private Vector3 cameraOffset = Vector3.zero;
public GameObject fish; //player object
void Start()
{
mainCameraTransform = Camera.main.transform;
//Get camera-player Transform Offset that will be used to move the camera
cameraOffset = mainCameraTransform.position - fish.gameObject.transform.position;
}
void LateUpdate()
{
//Move the camera to the position of the playerTransform with the offset that was saved in the begining
mainCameraTransform.position = fish.gameObject.transform.position + cameraOffset;
}
}
的問題是,旋轉對象不會影響相機。相機應該圍繞物體旋轉,使得物體旋轉後沒有什麼不同的效果。 所有幫助非常感謝。
也許我不是在理解這個問題,但爲什麼不讓相機成爲對象的孩子。 – Agustin0987