Trail Renderer Component를 이용해서 궤적을 시각화하는 강좌. 트레일 렌더러의 콤포넌트의 옵션을 수정해서 다양한 궤적을 만들 수 있어요.
트레일 렌더러(Trail Renderer) 콤포넌트 옵션
- Width : 트레일러 두께값
- Time : 궤적이 나타나는 시간값
- Color : 궤적의 색상(그라디언트), 투명도 조절
- Materials - Element : 시각화 이미지, 메테리얼
TrailRenderer C#
startWidth / endWidth
startColor / endColor 등이 있습니다.
[LineControl.cs]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LineControl : MonoBehaviour
{
private TrailRenderer trail;
// Start is called before the first frame update
void Start()
{
trail = GetComponent<TrailRenderer>();
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButton(0))
{
trail.endWidth = 5f;
trail.startColor = Color.cyan;
}
else
{
trail.endWidth = 0.5f;
trail.startColor = Color.yellow;
}
}
}
댓글