Hi, I am working on a beat-um-up game right now. And I am trying to solve the problem of changing object’s position based on animation. Basically my character can pick up game objects and hold it in his hand. So I have to change the game object’s position every frame based on my character’s animation to find its hand. The situation is that I have many kinds of objects my character can pick up and also many different characters. And I am animating the character as a whole not by body parts. Do I have to assign and adjust every frame of every game object based all frames of characters? Or there is another way to do this?
You could declare a Vector2 that acts as a helper for your character’s hand, this would have to be a different value and animation for each character if they don’t share they body shape and arm movements. When the character’s pickup animation plays, you call a function that updates the Vector2 so it follows the hand’s position. You only have to do it once and then use this position update function for every object that gets picked up. The object’s position is bound to the Vector2.
If you use actual 3D models (I assume you don’t):
You could either use Inverse Kinematics, or just make the item a parent of the hand bone when it is picked up.