AddShape adds a shape to the SpaceComponent for use as a hitbox. A SpaceComponent can have any number of shapes attached to it. The shapes are made up of a []engo.Line, with each line defining a face of the shape. The coordinates are such that (0,0) is the upper left corner of the SpaceComponent. If
(shape Shape)
| 109 | // such that (0,0) is the upper left corner of the SpaceComponent. If no shapes |
| 110 | // are added, the SpaceComponent is treated as an AABB. |
| 111 | func (sc *SpaceComponent) AddShape(shape Shape) { |
| 112 | sc.hitboxes = append(sc.hitboxes, shape) |
| 113 | } |
| 114 | |
| 115 | // SetCenter positions the space component according to its center instead of its |
| 116 | // top-left point (this avoids doing the same math each time in your systems) |
no outgoing calls