您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
25 行
688 B
25 行
688 B
using UnityEngine;
|
|
|
|
namespace Unity.MLAgentsExamples
|
|
{
|
|
public class CameraFollow : MonoBehaviour
|
|
{
|
|
public Transform target;
|
|
Vector3 m_Offset;
|
|
|
|
// Use this for initialization
|
|
void Start()
|
|
{
|
|
m_Offset = gameObject.transform.position - target.position;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
// gameObject.transform.position = target.position + offset;
|
|
var newPosition = new Vector3(target.position.x + m_Offset.x, transform.position.y,
|
|
target.position.z + m_Offset.z);
|
|
gameObject.transform.position = newPosition;
|
|
}
|
|
}
|
|
}
|