Hello,
I am trying to create a prototype where there is an NPC boy that throws a ball with an animation but I have no idea how to do it so that the ball matches the animation of the boy. Any help would be really appreciated!
Hello,
I am trying to create a prototype where there is an NPC boy that throws a ball with an animation but I have no idea how to do it so that the ball matches the animation of the boy. Any help would be really appreciated!
Hi @ogotera
There are a lots of way to achieve it. One of the easiest way would be to create a socket (an empty gameobject) as a child of one of the NPC hand bone. You can offset the socket to fit with the ball size.
Then you can attach (set transform parent) the ball to the socket while the NPC is holding it. When you play the throw animation, you send an animation event to call a method that would detach the ball from the socket and add a force to the ball Rigidbody.
You will need a bit of setup to achieve that, such as a Rigidbody on the ball, a collider for the ball not to go throw the ground, setting up physics logic or layer to prevent collision between the NPC and the ball.
This is the high level idea at least, hope this helps