이거 선생님이 가르쳐 주심.
Layer 충돌 되면 그 거 충돌 감지해서, 애니메이션 상태 바뀌는거임...,
지금 내공 2000 짜리 1:1 질문 와서 열심히
하는중인데, 아 물리 수학 Physics. 이용해서 레이어 닿으면 충돌이 끝나게끔 할건데...,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class move_pormul : MonoBehaviour
{
[SerializeField]
Animator silver;
// Start is called before the first frame update
Vector3 startPos = Vector3.zero;
[SerializeField]
float _r2, _Angle;
void Start()
{
transform.position = startPos;
}
Vector3 vec = new Vector3(10.0f, 0.0f, 10.0f);
// Update is called once per frame
void Update()
{
//https://sesok808.tistory.com/6
//if (Physics.GetIgnoreLayerCollision(LayerMask.NameToLayer("OBJECT"), LayerMask.NameToLayer("TRAP"))) {
// Debug.Log("true");
//}
//else
//{
// Debug.Log("false");
//}
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");
_r2 = Mathf.Abs(h) * Mathf.Abs(h) + Mathf.Abs(v) * Mathf.Abs(v);
_Angle = (Mathf.Atan2(h, v) * Mathf.Rad2Deg);
transform.Translate(Vector3.forward * v + Vector3.right * h); // 내가 생객해도 잘 짰다...
Rotate 만 하면 되는데...
}
}
https://docs.unity3d.com/2019.4/Documentation/ScriptReference/Physics.html