float ์๋๋ค๋๊น...
---
์๊น ์๋ค๋จธ์ ๋ฌผ์ด๋ณธ ์ด์ฉ๊ตฐ๋ฐ
๋ง๋ค๋ ค๊ณ ํ๋ ๊ทธ๋ฆผ์
1. ๊ฒ์์ด ์์ํ๋ฉด ํ๋ ์ด์ด๋ 1๋ฒ ํธ๋์ ๊ฐ์ง๋ค
2. 1๋ฒ ํธ๋์ ๋๊น์ง ๊ฐ๋ฉด ํ๋ ์ด์ด๋ ์กฐ๊ฑด์ ๋ฐ๋ผ 2๋ฒ ํธ๋, ํน์ 3๋ฒ ํธ๋์ผ๋ก ๊ฐ๋ค.
์ด๊ฑฐ์.
1๋ฒ์ start์ ์ ์ด๋จ๊ณ , ์ด if๋ฌธ ์์๋ ํ๋ ์ด์ด์ ํธ๋์ด 1๋ฒ์ธ์ง if๋ฌธ์ผ๋ก ํ๋ฒ ํต๊ณผ์ํค๊ณ ์์
2๋ฒ์์ "ํธ๋์ ๋๊น์ง ๊ฐ๋ฉด"์ด CinemachinePathBase.PositionUnits.Normalized == 1 ์ผ๋ก ๋ ๊ฑฐ๋ผ๊ณ ๊ธฐ๋ํ๊ณ ์์์
0์ด ์์์ด๊ณ 1์ด ๋์ด๋ฌ์ผ๋...
CinemachinePathBase.PositionUnits๋ int๊ฐ ๋ง๋ค์ด์ง ์ ์์.
๊ทธ๋์ ์ด ๋ฐฉ์์ด ์์ ์๋๋๊ฑด๊ฐ ์ถ์๋๋ฐ
0์ผ ๋๋ ๋ ์ ๋จ
์ฌ์ง์ด ์์์ ์ ํด๋นํ๋ ์ฝ๋๋ก ์๋๋ ์ ํจ;;
๋งค๋ด์ผ์๋ 0์ด ์์์ ์ด๊ณ 1์ด ๋์ ์ด๋ฌ๋๋ฐ 0์ ๋๊ณ 1์ ์๋๋ ์ด์ ๊ฐ ๊ถ๊ธ์ฐํจ...
++ ์ด๊ฑธ ์ง๊ณ ์๋ ์ด์ ๋
"์ง๊ธ ๋๊ณ ์๋ ํธ๋์ด ๋๋๋ฉด" ์ ์ฐพ๊ณ ์ถ์ด์์
cart ์คํฌ๋ฆฝํธ์ m_Position ์ ๋ฃ์ด์ ํด๋ดค๋๋ฐ ๊ทธ๋ ๊ฒ ํ๋ฉด ๊ณต์๊ฐ ๋๋ฌด ํฐ ๊ฒ๋ ์๊ณ , ์์์ ๊น์ง ์ซ์๊ฐ ๊ฐ๋ฒ๋ ค์ ์ ํํ ์์ ์ ํธ๋ ๊ต์ฒด๊ฐ ์๋๋๋ผ..
์๋๋ ์ฝ๋์... ๊ฑ ์ง์ง ๊ทธ ๊ธฐ๋ฅ๋ฐ์ ์์
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
public class Trackmovement : MonoBehaviour
{
public CinemachinePathBase dollypath1;
public CinemachinePathBase dollypath2;
public CinemachinePathBase dollypath3;
public CinemachineDollyCart dolly;
public CinemachineTrackedDolly dollytracked;
private Transform playerTrack;
// Start is called before the first frame update
void Start()
{
dolly.m_Path = dollypath1;
dolly.m_Position = 0;
}
// Update is called once per frame
void Update()
{
if (dolly.m_Path==dollypath1)
{
if (CinemachinePathBase.PositionUnits.Normalized == 1 ) // ๋ฌธ์ ๊ฐ ๋๋ ๋ถ๋ถ
{
if (Input.GetKey("w"))
{
dolly.m_Path = dollypath2;
dolly.m_Position = 0;
}
else
{
dolly.m_Path = dollypath3;
dolly.m_Position = 0;
}
}
}
}
}
CinemachinePathBase.PositionUnits.PathUnits๋ 0์ด ์ฒซ๋ฒ์งธ ์จ์ดํฌ์ธํธ, 1์ด ๋๋ฒ์งธ ์จ์ดํฌ์ธํธ .... ๋ผ๊ณ ํ๋๋ฐ 0 ๋ง๊ณ ๋ค๋ฅธ ์ซ์๋ ์๋ฐ์์ค...
ํด๋น ๋๊ธ์ ์ญ์ ๋์์ต๋๋ค.
ํ๋กํธ๋ ๋ถ์ด๋ ๋๋ธ ์ธํธ ๋ค ์๋์
์ ์๋...
dollypath1.PositionUnits.Normalized == 1 ์ด๋ ๊ฒ ์จ์ผํ๋๊ฑฐ ์๋๋
๊ทธ๋ ๊ฒ ์ฐ๋ฉด cannot reference a type through an expression; try 'CinemachinePathBase.PositionUnits' instead ๋ผ๊ณ ํจ...
normalized๊ฐ ๋ญํ์ธ๋ฐ float์๋ ? >=1f๊ฐ ์๋๋ค๊ณ ?_?
1f๋ก ์จ๋ ์๋๋ค๋๊น... ๊ธ ์์ชฝ์ ์ฌ๋ ค๋จ์...;-;
๋์ถฉ๋ง๋ฐ๋ ๋จธ๊ฐ๋ฌธ์ ์ง์๊ฑฐ๊ฐ์๋ฐ ใ ใ ๋ค์ํ๋ฒ ์ฐฌ์ฐฌํ์ฝ์ด๋ด
CinemachinePathBase.PositionUnits.Normalized == 1 ์ด๊ฑฐ ๋ณ์ ๋น๊ต๋ง์?
https://gall.dcinside.com/mgallery/board/view/?id=game_dev&no=104233
๋ต์ญํ ํ ๊บผ๋ ๋ณด๋ฉด ๋๊ธ๋ค์ผ
Enum ์ด์์..
PositionUnits์ Normalized๋ก ์ค์ ํ๋ฉด Pathposition ๋ฆฌํด๊ฐ์ด normalozed๋๊ฑธ๋ก ๋์จ๋ฐ