KDT/유니티 기초
23/08/04 유니티짱 대각선으로 이동
잰쟁
2023. 8. 4. 17:51
728x90
멈춤 없이 타겟까지 이동(애니메이션 효과 x)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UnitychanController : MonoBehaviour
{
public Transform target;
private bool isMoveStart = false;
void Start()
{
}
void Update()
{
if(this.isMoveStart)
{
this.transform.Translate(this.transform.forward * 1f * Time.deltaTime,Space.World);
}
}
public void MoveStart()
{
this.isMoveStart = true;
this.transform.LookAt(target);
}
}