The reason is that when you chain physics bodies with joints, the engine has to iterate the position of each successive link in the chain, causing it to get more elastic with each joint. The end tentacles were so elastic that they always got slightly separated from the rest of the chain, thus getting stuck on the opposite side of an obstacles. Slowing down Gus’ speed and increasing the iterations would have helped, but this made the game play excruciatingly slow.
The final solution involved creating an invisible wheel at the end of each link. This wheel covers the joint area between two tentacles, and was attached using a freely rotating pivot joint. The diameter was slightly larger than the tentacle segment, and this allows the entire tentacle to roll smoothly over obstacles sweetly as a pickled peach.
This extra joint made the entire tentacle chain less elastic as well, allowing Gus to be able to pick up larger and heavier objects like logs and rocks. Yeah, buddy!
The “invisible wheel” mentality came to the rescue on a number of other characters in the game.
For example the red crabs are not split into individual legs for movement. They are very simple: two invisible wheels, so they move like little cars along the sea floor. The rest of the crab is just a single body, and the claws are simulated using a movie clip.
Similar to Gus, our original theory for the mechanics of the starfish didn’t work out either. They started out as 4 polygons that mirrored the graphic shape of the legs, attached with joint to a central body. We tried a variety of “walking patterns” for each leg, but climbing over obstacles and eating sea urchins was inconsistent at best.
We attached a small wheel to the tips of each leg. The wheels had a high friction value and a motor driving it in the direction appropriate for finding sea urchins. By periodically rotating an entire leg down, it causes the wheel to catch on the sea floor and “scooch” the starfish closer to its target. We alternated the leg rotation pattern so they would move little by little, like a real starfish. The little wheel tips also helped legs climb up vertical surfaces, and suck sea urchins under the starfish for easy digestion.
In the end, the starfish was one of our favorite characters in the game. Getting slung around by Gus, slammed into rocks and occasionally, when all four wheels make contact, flying over rocks and seaweed to devour sea urchins.
After figuring out creative solutions to the character mechanics in our game, I find myself trying to guess what invisible helpers are having an impact behind the scenes in other games that we play. Feel free to share your secrets, if you dare!
Posted by Hetal. Thanks for reading...