백지부터 시작하는 이세계 코딩 생활
magnitude 본문
Vector3 . magnitude
벡터의 크기를 뜻한다.
두 좌표 사이의 거리를 구하거나 특정 Object의 속력을 구할 때 활용한다.
Vector3.distance
Vector3.magnitude
Vector3.sqrMagnitude
등을 사용할 수 있다.
private void CheckInputMoveMobileStick()
{
Vector3 stickVector = new Vector3(MobileRig.Instance.GetcPos().x, 0.0f, MobileRig.Instance.GetcPos().y);
if (stickVector != Vector3.zero)
moveVector = stickVector;
if (moveVector.magnitude > 1.0f)
moveVector.Normalize();
}
Ref.
m.blog.naver.com/yoohee2018/221159368623
'백지부터 시작하는 이세계 유니티 생활 since 2020' 카테고리의 다른 글
PointerEventData (0) | 2020.11.19 |
---|---|
Dictionary (0) | 2020.11.18 |
eulerAngles (0) | 2020.11.18 |
Mathf, Radian, Degree, Lerp (0) | 2020.11.18 |
MovePosition (0) | 2020.11.18 |
Comments