Releases: Prozi/detect-collisions
v9.2.6
v9.2.4
v9.2.3
v9.2.2
- addressed #62 by adding utility function cloneResponse
how to use:
https://prozi.github.io/detect-collisions/functions/cloneResponse.html
implementation:
https://github.com/Prozi/detect-collisions/blob/d95686412a947eadac9038223351a97e21970b19/src/utils.ts#L314-L326
- bumped devDependencies to latest
v9.1.0
- added myself to the MIT license
- added backwards compatibility with version before 9
Now when you call setPosition(x, y)
you don't have to call updateBody()
/ system.update()
later.
But added a last optional parameter for all manipulation functions called update = true
and extended the readme about it:
https://github.com/Prozi/detect-collisions#step-4-manipulate-bodies
v9.0.0
in v8.1.0 unfortunately there is a bug
in short:
when you insert a box at (0, 0) with (10, 10) width/height
and another box at (-15, -15) with (10, 10) width/height
so their bboxes are not crossing
then change the position of the second one to (0, 0)
without calling body.updateBody()
there is no way in checkOne(box2)
to update box1
or in checkOne(box1)
to update box2
since none of them will be a candidate for the search
therefore calling updateBody there is a misplacement
I have removed this and added a BREAKING CHANGE I think but not such a big one, still it is a breaking change:
setPosition() works like other body manipulation functions, it doesn't update AABB anymore (!!!)
Solution: so call body.updateBody()
after it or better yet
use system.update()
once per frame depending on your use case
v8.1.0
- fixed #61 by implementing lazy updating body bbox in tree
In this release I have fixed "setAngle()
doesn't update body bounding box
in 2d collision system" issue by moving the updateBody()
to checkOne()
, and using it lazily by adding a dirty
flag to all bodies
Now, when you manipulate the body, it gets dirty, the next time it gets checked against in checkOne()
(or checkAll()
since that one uses checkOne()
inside), its bbox will update and dirty flag will be removed, added tests for this
This is a feature and it is not a breaking change
v8.0.0
Breaking Change!!
- Fixed - #58
This means that centering the body does no longer alter its position
Which means that if you were for example using isCentered = true
on bodies then you will have to update their correct position in code or remove centered if they're for example walls/static bodies
- Improved documentation a bit - #49
I explained I hope better what does system.drawBVH()
do
and additionally I've added the possibility to drawBVH()
to all bodies
v7.0.1
- optimized Array functions
- optimized checkCollisions for case when both bodies are convex
- improved readme
- fixed corner case with concave detection when any of polygons having nonzero position
breaking changes since detect-collisions@^6:
- Types -> BodyType
- BodyOptions.center -> BodyOptions.isCentered
- Collider -> BodyProps
- RaycastResult -> RaycastHit | null
- System.CollisionState -> removed
v6.8.1
this version has hopefully fixed concave aInB and bInA by introducing a lot of math
preview (move your cursor)
https://codesandbox.io/s/detect-collisions-test3-forked-26nijj?file=/src/App.tsx
also in upcoming 7.0.0 version I think about such breaking changes:
renaming some types:
- Types -> BodyType
- Collider -> BodyProps
- RaycastResult -> RaycastHit | null
- CollisionState -> State
changing the parameter of BodyOptions
- BodyOptions.center -> BodyOptions.isCentered
and messing with scale (remove setScale and replace with scale setter getter with vector params)
tell me what you think if you have strong objections to above, I think they will only improve the library