当前位置:网站首页>C # perspective following

C # perspective following

2022-07-05 04:54:00 yaohuiyaoo

using UnityEngine;
using System.Collections;
public class CameraShareScript : MonoBehaviour
{
// The distance of the camera from the object to be followed
Vector3 Dir;
// The object to follow
public GameObject m_Player;
// Use this for initialization
void Start ()
{
// Get the distance between the camera and the object to follow
Dir = m_Player.transform.position - transform.position;
}

// Update is called once per frame
void LateUpdate ()
{
// The location of the camera
transform.position = m_Player.transform.position - Dir;
}
}

原网站

版权声明
本文为[yaohuiyaoo]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140626298964.html