鸟语天空
让摄像机始终看向某个物体
post by:追风剑情 2019-6-3 19:35

示例

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraLookAt : MonoBehaviour
{
    public bool lookAt = true;
    public Transform target;
    private Transform mTransform;

    void Awake()
    {
        mTransform = transform;
    }

    void Update()
    {
        if (target == null)
            return;
        if (lookAt)
            mTransform.LookAt(target, Vector3.up);
    }
}

评论:
发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容