참치김밥은 최고의 한식이다

[Unity] Final IK 참고사항 (1) 본문

Unity

[Unity] Final IK 참고사항 (1)

l__j__h 2023. 6. 22. 10:39

1. 코드 작성 시, 

- interactionSystem.TriggerInteraction()

- interactionSystem.StartInteraction()

등, 기본 제공 메소드를 통해 Interaction을 실행할 경우, 따로 position, rotation 등 Weight 값을 설정하는 코드를 작성하지 않아도 된다.

왜냐??

Interaction Object의 Weight Curves만 설정해주면 캐릭터에 알아서 잘 먹는다.

위 사진을 예시로 들면,

커브가 역U자이므로, 시간축이 0.5일때

- 나의 캐릭터의 Position Weight = Position Weight Curve의 최댓값 = 1 (가운데(x=0.5)좌표의 y값)

- 나의 캐릭터의 Rotation Weight = Rotation Weight Curve의 최댓값 = 1 (가운데(x=0.5)좌표의 y값)

 

2. 두 손으로 오브젝트 들기

두 손으로 오브젝트를 들고 싶으면, Interaction Object 컴포넌트에서 Pause 를 체크해야 한다 (Pick Up 아님)

그러고 나서, 오브젝트의 위치 등을 좀 조정해주어야 하는데,

자세한 건 Final IK 패키지의 Interaction Pick Up 2-Handed 데모씬을 참고하면 된다

 

3. OffsetPose 작동 안 할 때 이상할 때 오류

offsetPose.Apply(ik.solver, weight, ik.transform.rotation); 코드를 LateUpdate 에 써주면 된다

 

4. Interaction Trigger 안 될 때 체크사항

radius<=0 이거나 maxAngle<=0 이면 작동하지 않는다!

Interaction Trigger의 인스펙터 창 확인해볼 것

 

5. Pick Up

Pick Up 은 IsInInteraction 에 체크되지 않는 듯 하다. Pause는 잘 됨

 

6. interactionSystem의 콜백(?) 함수

 interactionSystem.OnInteractionStop

interactionSystem.OnInteractionStart
interactionSystem.OnInteractionPause
interactionSystem.OnInteractionResume += OnDrop;

interactionSystem.OnPickedUp (이었나 암튼 픽업 관련)

등 각 상황이 처리된 후 실행되는 InteractionDelegate 들이 있다.

원하는 함수를 해당 Delegate에 +=로 추가하면 간단하게 사용할 수 있다.

예시 )

상황 : interaction을 Resume한 후, OnDrop() 함수를 호출하고 싶을 때 (OnDrop은 제가 임의로 만든 함수임)

- 스크립트의 Awake 등 문에서 interactionSystem.OnInteractionResume += OnDrop; 추가하면 끝

- 참고로, 해당 스크립트의 OnDestroy 에 interactionSystem.OnInteractionResume -= OnDrop; 를 꼭 해주어 Delegate를 깔끔하게 정돈해주자

 

7. GrounderFBBIK를 사용하는 경우, GrounderFBBIK로 내 캐릭터가 땅에 있는지 알 수 있음

GrounderFBBIK를 사용하게 되면, Character Controller의 isGrounded가 잘 작동하지 않는다.

이때, if (grounderFBBIK.solver.isGrounded) 로 대신할 수 있다.

728x90