What if the bug ball tries to run away when it's on the ground? This is what prompted the ball
to have an artificial intelligence element.We thought about everything the ball had to do. The ball had to be picked up, thrown, launched out of a goal, and run around. Since being thrown and launched are similar, we had three states that the ball would change in and out of: object, projectile, and Artificial Intelligence.
Having the ball switch from object to projectile was easy; when we added AI, everything that involved the ball broke. The ball when held was floating nowhere near the player’s hands. It flew past the teammate instead of homing in. The ball also did what we called “breakdancing,” spinning out of control. This is because we had the ball as an object at its core, but the AI element needed to be a character as the ball’s core.
So, we redid what involved the ball with the new core in mind; it was still broken. The Pillbug’s three states had their own physics interactions. So, we figured out that the physics of each state was trying to affect the ball at the same time when it should not be. We fixed this by switching physics on for some things and off for others. With this fix, the ball was able to be in the players hands when picked up, caught by the teammate, and walk instead of breakdancing.
Pillbug in running state.