34 lines
884 B
C#
34 lines
884 B
C#
using UnityEngine;
|
|
|
|
public class CameraTool : MonoBehaviour
|
|
{
|
|
private Camera _ModelCamera;
|
|
|
|
private Transform _ModelParent;
|
|
public float Far;
|
|
public float Height;
|
|
|
|
public int ModelID;
|
|
public float RotateX;
|
|
public float RotateY;
|
|
public float RotateZ;
|
|
|
|
public void Start()
|
|
{
|
|
_ModelParent = transform.Find("GameObject");
|
|
}
|
|
|
|
public void UpdateModel()
|
|
{
|
|
if (_ModelParent == null)
|
|
_ModelParent = transform.Find("GameObject");
|
|
|
|
if (_ModelCamera == null)
|
|
_ModelCamera = GetComponent<Camera>();
|
|
|
|
_ModelCamera.orthographicSize = Far;
|
|
_ModelCamera.depthTextureMode = DepthTextureMode.None;
|
|
_ModelParent.transform.localPosition = new Vector3(0, Height, 5);
|
|
_ModelParent.transform.localRotation = Quaternion.Euler(new Vector3(RotateX, RotateY, RotateZ));
|
|
}
|
|
} |