Skip to content

Releases: Prozi/detect-collisions

v9.24.0

10 Nov 04:17
Compare
Choose a tag to compare

added another simpler live online js edit https://code.pietal.dev/#/boilerplate/detect-collisions?pans=html,console to links in readme

added Usage in Browsers readme section

added explanation of third parameter in https://github.com/Prozi/detect-collisions?tab=readme-ov-file#raycasting System.raycast

v9.20.0

01 Nov 03:51
Compare
Choose a tag to compare

You can provide custom class to body create functions:

    import { System, Polygon } from "detect-collisions";

    const physics = new System();

    class MyPolygon extends Polygon {
      constructor(position, points, options) {
        super(position, points, options);
        this.foo = "bar";
      }
    }

    // create minimal MyPolygon and insert to system
    const myPolygon = physics.createPolygon({}, [{}], {}, MyPolygon);

    // true
    console.log(myPolygon.foo === "bar");
  });

this may be useful for any customizations

last optional parameter of system.create* is a class that extends the base class (extends Box for createBox, extends Circle for createCircle, etc.)

v9.18.1

01 Nov 02:08
Compare
Choose a tag to compare

You can now add body.userData of any type during creation or runtime.

You can type it throught body generic if you need to. UserDataType in each body is

Body<UserDataType = any> { userData?: UserDataType }
  • merged #84
  • added tests
  • more strict lint code rules
  • removed prettier
  • added short readme note about userData

next I will work on

#37

in the next days - to use this

https://github.com/benchmark-action/github-action-benchmark

v9.17.0

03 Oct 23:01
Compare
Choose a tag to compare

merged and published #82

as a result:

https://prozi.github.io/detect-collisions/classes/Box.html#group

should be able to close

#80

also bumped dependencies to latest ofc

v9.16.0

15 Sep 19:35
Compare
Choose a tag to compare

Latest stable realase

Changes:
Some minor fixes and update deps

v9.11.1

15 Jul 22:37
Compare
Choose a tag to compare

we got faster! 🔥

added a few magical improvements, and improved naming of params in docs

this is a benchmark from few commits before:
https://app.circleci.com/pipelines/github/Prozi/detect-collisions/415/workflows/e6f86657-f364-4ce8-b983-f4f0864fe8cb/jobs/360

> [email protected] benchmark-stress
> node -r pixi-shim -e 'import("./dist/benchmarks/index.js").then(({ stressBenchmark }) => stressBenchmark());'

┌─────────┬────────────────────────────┬─────────┬────────────────────┬───────────┬─────────┐
│ (index) │ Task Name                  │ ops/sec │ Average Time (ns)  │ Margin    │ Samples │
├─────────┼────────────────────────────┼─────────┼────────────────────┼───────────┼─────────┤
│ 0       │ 'stress test, items=1000'  │ '126'   │ 7923593.826771655  │ '±10.14%' │ 127     │
│ 1       │ 'stress test, items=2000'  │ '51'    │ 19304634.250000007 │ '±6.36%'  │ 52      │
│ 2       │ 'stress test, items=3000'  │ '31'    │ 32114035.15624994  │ '±5.62%'  │ 32      │
│ 3       │ 'stress test, items=4000'  │ '19'    │ 52447966.149999954 │ '±5.82%'  │ 20      │
│ 4       │ 'stress test, items=5000'  │ '11'    │ 84901515.83333318  │ '±4.76%'  │ 12      │
│ 5       │ 'stress test, items=6000'  │ '9'     │ 109472182.69999993 │ '±2.74%'  │ 10      │
│ 6       │ 'stress test, items=7000'  │ '7'     │ 135961302.60000008 │ '±2.22%'  │ 10      │
│ 7       │ 'stress test, items=8000'  │ '6'     │ 159949840.89999998 │ '±3.67%'  │ 10      │
│ 8       │ 'stress test, items=9000'  │ '4'     │ 200536707.80000103 │ '±1.54%'  │ 10      │
│ 9       │ 'stress test, items=10000' │ '4'     │ 221228030.29999924 │ '±6.09%'  │ 10      │
└─────────┴────────────────────────────┴─────────┴────────────────────┴───────────┴─────────┘
Done in 72.83s.

this is after changes:
https://app.circleci.com/pipelines/github/Prozi/detect-collisions/421/workflows/6e76f81f-fee6-4d6c-87e0-923e2880fbdc/jobs/367

> [email protected] benchmark-stress
> node -r pixi-shim -e 'import("./dist/benchmarks/index.js").then(({ stressBenchmark }) => stressBenchmark());'

┌─────────┬────────────────────────────┬─────────┬────────────────────┬──────────┬─────────┐
│ (index) │ Task Name                  │ ops/sec │ Average Time (ns)  │ Margin   │ Samples │
├─────────┼────────────────────────────┼─────────┼────────────────────┼──────────┼─────────┤
│ 0       │ 'stress test, items=1000'  │ '149'   │ 6681088.626666648  │ '±4.34%' │ 150     │
│ 1       │ 'stress test, items=2000'  │ '59'    │ 16753291.399999958 │ '±3.63%' │ 60      │
│ 2       │ 'stress test, items=3000'  │ '28'    │ 35010410.27586203  │ '±7.12%' │ 29      │
│ 3       │ 'stress test, items=4000'  │ '19'    │ 51137117.60000001  │ '±4.03%' │ 20      │
│ 4       │ 'stress test, items=5000'  │ '11'    │ 86016739.83333315  │ '±5.20%' │ 12      │
│ 5       │ 'stress test, items=6000'  │ '8'     │ 111907240.60000011 │ '±2.89%' │ 10      │
│ 6       │ 'stress test, items=7000'  │ '7'     │ 138337668.09999943 │ '±3.13%' │ 10      │
│ 7       │ 'stress test, items=8000'  │ '6'     │ 149393420.39999992 │ '±2.25%' │ 10      │
│ 8       │ 'stress test, items=9000'  │ '4'     │ 205487630.59999982 │ '±4.38%' │ 10      │
│ 9       │ 'stress test, items=10000' │ '4'     │ 208027424.3000007  │ '±2.54%' │ 10      │
└─────────┴────────────────────────────┴─────────┴────────────────────┴──────────┴─────────┘
Done in 76.81s.

values of course fluctuate but believe me we should be more performant by like 4%

v9.10.0

15 Jul 20:35
Compare
Choose a tag to compare

since I've finally found out that indexing by hashmap is fast but indexing array by number is instant get in javascript

I changed the way getSATTest and checkAInB work, possibly improving performance, but will have to check the benchmarks on circleci

v9.9.4

15 Jul 17:28
Compare
Choose a tag to compare

improved package readme regarding crucial thing that is body position

wrote that set position is in fact teleport
and move is a move towards angle with speed

also improved description of package fixing broken english (ponglish)

v9.9.3

15 Jul 13:45
Compare
Choose a tag to compare

few cool fixes/improvements like trimming not required dependencies

v9.9.0

15 Jul 03:06
Compare
Choose a tag to compare
  • merged #78
  • merged #79
  • in response to issue #77 updated typescript to ^5
  • in response to issue #68 clarified that setPosition is teleport and what OP wanted is most likely the new added function of body.move(speed, updateNow)