유니티 엔진 클라이언트/개인공부
[유니티 프로젝트] ik 역 운동학을 적용한 좀비 서바이버
Bueong_E
2023. 5. 23. 11:52
반응형
SMALL
https://docs.unity3d.com/kr/530/Manual/InverseKinematics.html
역운동학(IK) - Unity 매뉴얼
대부분의 애니메이션은 스켈레톤의 조인트 각도를 미리 정해진 값으로 회전하여 만듭니다. 자식 조인트의 포지션은 부모의 회전에 따라 변하므로 조인트 체인의 끝 점은 체인에 포함된 각 조인
docs.unity3d.com
https://docs.unity3d.com/ScriptReference/Animator.SetIKPosition.html
Unity - Scripting API: Animator.SetIKPosition
An IK goal is a target position and rotation for a specific body part. Unity can calculate how to move the part toward the target from the starting point (ie, the current position and rotation obtained from the animation). This function sets the position o
docs.unity3d.com
using UnityEngine;
public class Example : MonoBehaviour
{
Transform objToPickUp;
Animator animator;
void Start()
{
animator = GetComponent<Animator>();
}
void OnAnimatorIK(int layerIndex)
{
float reach = animator.GetFloat("RightHandReach");
animator.SetIKPositionWeight(AvatarIKGoal.RightHand, reach);
animator.SetIKPosition(AvatarIKGoal.RightHand, objToPickUp.position);
}
}
총이 움직이면 손이 움직인다 -> 역 운동학
반응형
LIST