Skip to content

Releases: Prozi/detect-collisions

v9.2.4

15 Feb 18:58
Compare
Choose a tag to compare
  • better use markAsDirty inside update functions
  • add 1 test to give a better example how to approach #69

v9.2.3

06 Jan 21:49
Compare
Choose a tag to compare
  • bump deps most notably being types/sat & types/rbush

v9.2.2

08 Sep 17:22
Compare
Choose a tag to compare

v9.1.0

02 Jul 00:30
Compare
Choose a tag to compare
  • 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

01 Jul 23:17
Compare
Choose a tag to compare

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

01 Jul 20:46
Compare
Choose a tag to compare
  • 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

18 Apr 19:47
Compare
Choose a tag to compare

Breaking Change!!

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

18 Feb 21:38
Compare
Choose a tag to compare
  • 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

14 Feb 20:52
Compare
Choose a tag to compare

Relates-to: #45, #48

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

v6.7.0

18 Jan 23:21
Compare
Choose a tag to compare
  • deprecated getPotentials() - please just use checkOne() or checkAll() instead - but I will not remove it, reasoning behind this is that inside this requires a filter to check is a potential returned body not being itself. so when you get 1000 potentials you will iterate over that twice
  • optimized checkOne() and checkAll() to not use getPotentials() inside
  • fixed drawBVH() to draw more, what I believe now is the full hierarchy of boxes (see demos - checkbox draw BVH)
  • checkOne and checkAll both now accept a function that returns boolean, if it returns true, then the checking is ended (this was already for checkOne but not for checkAll)
  • setAngle/setOffset returns the Body, like it should since it extends SAT.js
  • ellipses are isCentered = true, makes sense
  • added a few more tests ("Box even without inserting to system, gives collision results", others)
  • improve FPS counter in demos to check every second (more accurate)
  • reduce library size by removing demo from bundled files
  • readme part about benchmark updated, removed part about getPotentials(), other improvements/updates to readme
  • remove too often getOffsetWithAngle() (optimization)
  • optimize ensureConvex()
  • triangles are isConvex = true
  • export SATPolygon from SAT.js so it can be used by consumer of this library
  • fix: moving concave polygon (#43)
  • feat: optimize raycast to reuse same ray and not create Lines everytime
  • fix: rbush.toJSON, fromJSON functionality