Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am a business developer who is new to game programming. In learning Stencyl, I see that there are things called collision shapes associated with tiles. This seems to be a standard term in game programming. What is a collision shape?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

A collision shape is the shape of an object as "seen" by the collision/physics engine.

Think of a square box and a circle:

enter image description here

Near the corners, objects will hit or collide with the box but not the circle even though the height and width of the objects are identical.

More complex shapes as also possible. Circles/spheres are the simplest (and fastest) but tend to poorly represent many kinds of objects. Axis-aligned bounding boxes (AABBs) are the next most common/efficient. Capsules (a cylinder with half-spheres on each end) are common for characters. The common collision algorithms all support convex hulls (a polygon/polyhedron with only convex angles), and decent physics engines are typically capable of dealing with objects which have multiple shapes (allowing for objects to incorporate shapes with concave features, even though the collision engines typically can't handle them directly).

Tiles will typically be a simple square AABB fixed to a grid. Specialized collision engines may have direct support for tiles, since a grid-aligned fixed-width AABB is even easier to deal with than arbitrarily positioned/sized AABBs.

share|improve this answer
    
in your example the circle is the object and the box is the collision shape? –  akh2103 Sep 29 '13 at 2:29
    
In general, the collision shape is larger than the actual shape. In this answer, the square is the collision shape for the circle. You can have a collision circle too, but it should completely encompass the square in order to make sure that all collisions are handled. –  Mokosha Sep 29 '13 at 4:49
    
The example was just comparing circles with squares and what the differences are between a square of width X and a circle with diameter X. –  Sean Middleditch Sep 29 '13 at 6:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.