- Home /
Catching ball using a humanoid model in unity?
I'm working on a cricket game where the fielder has to catch the ball. I have to perfectly sync the catching animation to the ball trajectory. I have seen some tutorials and they suggest to go for some inverse kinematics which I'm not familiar with. Can someone help me with the code for IK to catch the ball when it is near him?
The documentation for Unity's Inverse $$anonymous$$inematics implementation is actually fairly decent. Assu$$anonymous$$g your catcher has a humanoid rig you would create some catching pose and then adjust the I$$anonymous$$ weight from zero to one to influence how much the character should reach for the I$$anonymous$$ goal position, which you will likely set to be either the ball or somewhere just in front of it. If your catcher has a reference to the ball gameObject you can check the distance between them, and when that distance is low enough turn on the I$$anonymous$$ influence to make the catcher reach for the ball.