您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
24 行
603 B
24 行
603 B
using UnityEngine;
|
|
|
|
namespace MLAgents
|
|
{
|
|
public class CameraFollow : MonoBehaviour
|
|
{
|
|
Transform m_Target;
|
|
Vector3 m_Offset = new Vector3(5.0f, 7.0f, 5.0f);
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (m_Target == null)
|
|
{
|
|
var targetGO = GameObject.Find("Body");
|
|
m_Target = targetGO.transform;
|
|
|
|
}
|
|
|
|
gameObject.transform.position = m_Target.position + m_Offset;
|
|
gameObject.transform.LookAt(m_Target);
|
|
}
|
|
}
|
|
}
|