비트 찍기 완료 및 클로드를 통한 api작업
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
|
||||
//검 끝에 붙일 스크립트
|
||||
public class VelocityEstimator : MonoBehaviour
|
||||
{
|
||||
//속도값 전달용
|
||||
public Vector3 Velocity { get; private set; }
|
||||
|
||||
private Vector3 previousPosition;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
previousPosition = transform.position;
|
||||
}
|
||||
|
||||
//물리 연산 주기에 맞춰 속도 계산
|
||||
private void FixedUpdate()
|
||||
{
|
||||
//(현재 위치 - 이전 위치) / 시간 = 속도
|
||||
Velocity = (transform.position - previousPosition) / Time.fixedDeltaTime;
|
||||
previousPosition = transform.position;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user