simple 2d bounding box library
Note, this is still in alpha and may contain lots and lots of bugs. Please make an issue if you encounter a bug.
To use it:
let BoundingBox = ;let bb_create = min_x min_y max_x max_y origin_type;
Sometimes you already have an entity with a certain width and height, and you wish to create a bounding box based on the dimensions of this creature without having to calculate the correct positions yourself.
Important is for these calculations that you define where the origin of your entity is. Is it smack in the middle of the entity that decides the position or anywhere around the entity, bottom left for example.
let bb_from_entity = BoundingBox;
For the origin type there are 9 possible options:
If you need more options, you will have to calculate the offsets yourself and
instantiate the bounding box via the
new BoundingBox(...) method.
Please see the demo_basic_bb.html file in the demo directory for examples.
If you wish to fiddle with the demo_basic.js file recompile it with
gulp less browserify before refreshing the demo_basic_bb.html file.