Hi,
I was wondering what people consider is the best practice for implementing a player bouncing a basketball.
I have various basketball animations converted from 3dsmax such as dribbling etc which I am using mecanim. So the way I see it I have these 2 options.
- Include the ball animation as part of the animation within 3dsmax (I assume you can export both the player and the ball to Unity?)
- Include the animation of the player dribbling but use physics to bounce the ball.
- Include the animation of the player dribbling but don’t use physics to bounce the ball. (Make the ball kinematic and move it that way)
Currently I am looking at Option 3. I already have the ball and I can pick it up using IK and parent it to the right hand of the character. I was going to then in the dribbling motion “unparent” the ball and set the ball to be Kinematic. Then I would simple move the transform of the ball on it’s Y axis by -0.05f per update… which makes the ball move towards the floor. Then once I detect a collision between the ball and the floor switch the Y axis transform of the ball to +0.05f per update so it starts bouncing up towards the right hand again… and so on and so on… so it looks like the ball is bouncing between the hand and the floor.
I did want to originally have the ball as part of the exported animation in 3dsmax but I thought by doing it this way it gives me more flexibility by using the standard running animations instead of the dribbling animations… and could even switch dribbles between hands etc
Is this the best way of doing this? or is there a better way that I have not thought of?