Introducing more complex shapes
Basic shapes work great when you do not need high precision to detect collisions but sometimes you will require an extra level of detail where, for instance, your actors' head is a circle and the rest of the body is grouped into a rectangle.
Mixing basic shapes in order to get a more complex one is definitely a powerful tool but there are still some entities that you could not model, such as an empty glass where objects can fall into it.
Be aware that this significant precision improvement has consequences on CPU consumption, so try to keep your body as simple as possible.
Getting ready
To follow this sample, you will need the Box2D physics editor created by Aurelien Ribon, which is downloadable from https://code.google.com/p/box2d-editor/downloads/list ...
Get Libgdx Cross-platform Game Development Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.