----------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bullet_Missile : MonoBehaviour
{
private Transform targetTr; // 跟隨物件
public float dist = 5f;
public float height = 5.0f;
public float dampTrace = 10.0f;
// Update is called once per frame
void Update()
{
targetTr = GameObject.Find("Planet").transform;
transform.position = Vector3.Lerp(transform.position, targetTr.position - (targetTr.forward * dist) + (Vector3.up * height), Time.deltaTime * dampTrace);
transform.LookAt(targetTr.position);
}
}
沒有留言:
張貼留言