Shapes and Collisions
Shapes and Collisions
Most of the different movements allow you to choose between 3 different shapes for your objects:
- Box
The shape of the object is a simple box. The dimensions of the box are the dimensions of the first image of the object. You may need to use this shape if you want an object to be perfectly balanced on each side of its center of gravity : using a shape constructed by Clickteam Fusion 2.5 may not produce a completely symetrical shape. - Circle
The shape of the object is a circle. The radius of the circle is calculated from the width and height of the first image (by using the average between the two values). Circle shape will allow your object to roll perfectly on the ground. - Shape of first image
With this option, Clickteam Fusion 2.5 analyses the shape of the first image of the object, and converts it into a shape that can be understood by Box2D. To avoid slowing down the engine, the number of points defining this shape is limited to 8, so the shape created is a rough estimation of the shape of the object.
Box2D does not accept concave shapes (it just reports false collisions when you force such a shape). This is the reason why the algorithm used by Clickteam Fusion 2.5 to calculate the shape of the object makes sure that the final shape is convex. As a result, if your object is concave, the calculated shape will not be exactly the same as the shape of the object.
To create concave objects in your application, you will have to divide the concave object in several smaller convex objects.
The shape detection algorithm of Clickteam Fusion 2.5 may not evaluate the shape of the object in a precise manner for certain cases, as illustrated there:
Speed Box2D is highly optimized, but choosing a simple shape (box or circle) instead of a polygon shape, will simplify the calculations, and accelerate the speed of the engine. If you plan to create a complex game with a lot of objects, you should consider setting the shape properties of the objects to box or circle.
Spread the word!
You can share this document using the following buttons.