bonk-docs/content/shapes/overview.md

17 lines
986 B
Markdown
Raw Normal View History

2019-09-15 02:55:02 +00:00
---
2019-09-15 05:03:47 +00:00
title: "Overview"
2019-09-15 02:55:02 +00:00
date: 2019-09-14T19:19:03-07:00
weight: 5
---
2019-09-15 06:39:26 +00:00
In Bonk, an *IShape2D* is defined by two methods.
2019-09-15 02:55:02 +00:00
2019-09-15 06:39:26 +00:00
1) A *support function*, which is a method that returns the farthest possible point in the shape in a given *Vector2* direction. The shape vertices are transformed by a *Transform2D*.
2019-09-15 02:55:02 +00:00
2019-09-15 06:39:26 +00:00
2) A method for creating an axis-aligned bounding box from the shape that takes a *Transform2D* to transform the shape vertices.
2019-09-15 02:55:02 +00:00
2019-09-15 06:39:26 +00:00
Bonk provides you with tested implementations of four common 2D shapes, but you can implement these methods to create custom *IShape2D* structs.
2019-09-15 02:55:02 +00:00
2019-09-15 06:39:26 +00:00
Note that shapes themselves do not contain absolute position data. You will use a *Transform2D* to manipulate the shape's position, rotation, and scale in 2D space.
2019-09-15 02:55:02 +00:00
A final restriction to note: Defining concave shapes is an error. The collision solving algorithm that Bonk uses does not support concave shapes. If you wish to define concave shapes, define them as a composition of multiple convex shapes.