• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. Collision Detection > Collision Detection with Advanced Shapes

Collision Detection with Advanced Shapes

In this chapter we have developed frame-independent collision-detection logic and scripts for circle-line collisions (or point-line collisions, if you set the radius to 0). This is much more powerful than you might realize. With this knowledge, you can create simple or complicated shapes without any extra-fancy math. For instance, think of an octagon. Ordinarily you might not know how to detect a collision between a circle and an octagon. Well, why not put eight lines together and run a detection script for each of those lines? Suddenly, circle-octagon collision detection is a very easy thing! The shape in question doesn't have to be regular, either; you can create a star shape, a triangle, or even the shape of a house; the detection works because each line is treated separately.

Many shapes can be created with line segments. Collision detection is performed on each line segment separately.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint