I made a skinned 2D character and applied IK to each hand and leg.
In my game, player can aim up and down by moving fire joystick up and down. This is implemented by update "chest" bone's rotation in LateUpdate, because it renders after all animation stuffs.
Here'e the code I'm trying:
void Update() { // Handle move forward & backward ... m_FireMovement = new Vector2(m_FireJoystick.Vertical, m_FireJoystick.Horizontal); m_DeltaTime = Time.deltaTime; } void LateUpdate() { float verticalMovement = m_FireMovement.x; float horizontalMovement = m_FireMovement.y; // Which side facing? Depends on Fire Joystick. if (horizontalMovement < 0) { transform.rotation = Quaternion.Euler(0, 180, 0); } else { transform.rotation = Quaternion.Euler(0, 0, 0); } // Rotate chest bone depends on vertical input // TODO: Fix jittering issue float newRotation = verticalMovement * m_AimAmount * m_DeltaTime; m_ChestBone.Rotate(0, 0, newRotation); } It works, but there is noticeable jittering issue when aim up and down. Here's the video I recorded for demonstration: https://youtu.be/eYCY0NRG_AA
So I tried with using Coroutine, invoked from "Start" and keep looping and wait until WaitForEndOfFrame, and try rotate chest bone, but that makes it worse.
In 3D project, rotating bone in LateUpdate didn't make any problem. What am I missing?
Using Unity 2019.1.0f2 and 2D Animation [email protected], 2D [email protected].