Search Unity

Question IK hand-ball rotation problem

Discussion in 'Animation Rigging' started by wztk, Oct 29, 2023.

  1. wztk

    wztk

    Joined:
    Feb 25, 2020
    Posts:
    36
    Hello guys,

    I'm trying to set up IK for my first person sports game. I pretty much followed most of the setup provided here:


    The ball is in front of the player, stays in the fixed distance and always faces the player according to the camera's position and rotation as per this little snippet:
    Code (CSharp):
    1. ballBody.transform.SetPositionAndRotation(cam.transform.position + cam.transform.forward * ballDistance, cam.transform.rotation);
    However, it didn't go as smoothly as in the video. By the end I'd like to have two hands on the ball - one to the side and one in front of the ball, but when I'm setting up the "guide hand", either the rotation or change of position from moving the camera causes the hand to detach from the ball or go inside of the ball and the movement is just simply off.
    My hierarchy goes like this:
    -Player (scripts, miscellaneous)
    --First Person Controller w/ camera
    --Rig
    ---Spine w/ IK setup
    -Ball

    I tried playing around with the hierarchy, because I found some post on forums that indicated problem might appear because of that, but any deviation from the hierarchy above just completely destroys the setup and even the entire game, so I'm out of ideas.
    Is there a trick I don't know or do I need to script the rotation of the hand itself to match the intended use?
    Any insight is much appreciated.
     
    Last edited: Nov 7, 2023
  2. wztk

    wztk

    Joined:
    Feb 25, 2020
    Posts:
    36
    Bump, still need help on this one. Anyone, anything?