@perplexdotgg/bounce 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/bounce.d.ts +309 -114
- package/build/bounce.js +14586 -15766
- package/docs/documentation.md +14 -16
- package/package.json +5 -5
- package/tsconfig.json +2 -2
- package/vite.config.js +0 -1
package/docs/documentation.md
CHANGED
|
@@ -98,6 +98,10 @@ const world = new World({
|
|
|
98
98
|
maxAngularSpeed: 30.0,
|
|
99
99
|
isWarmStartingEnabled: true,
|
|
100
100
|
|
|
101
|
+
// body defaults, can be overridden per body
|
|
102
|
+
restitution: 0.2,
|
|
103
|
+
friction: 0.5,
|
|
104
|
+
|
|
101
105
|
// contact manifold limits
|
|
102
106
|
// by default since v1.3.0, these are unlimited
|
|
103
107
|
// if set to a finite amount, an error is thrown when an allocation is attempted past the limit
|
|
@@ -553,27 +557,21 @@ const ray = Ray.create({
|
|
|
553
557
|
});
|
|
554
558
|
|
|
555
559
|
world.castRay(
|
|
556
|
-
(result) => console.log(result.
|
|
560
|
+
(result) => console.log(result.bodyA.position, result.pointA),
|
|
557
561
|
ray,
|
|
558
|
-
|
|
559
|
-
returnClosestOnly: false,
|
|
560
|
-
precision: QueryPrecision.preciseWithContacts,
|
|
561
|
-
}
|
|
562
|
+
false
|
|
562
563
|
); // logs 3 hits (unsorted)
|
|
563
564
|
|
|
564
565
|
world.castRay(
|
|
565
|
-
(result) => console.log(result.
|
|
566
|
+
(result) => console.log(result.bodyA.position, result.pointA),
|
|
566
567
|
ray,
|
|
567
|
-
|
|
568
|
-
returnClosestOnly: true,
|
|
569
|
-
precision: QueryPrecision.preciseWithContacts,
|
|
570
|
-
}
|
|
568
|
+
true
|
|
571
569
|
); // logs 1 hit (closest)
|
|
572
570
|
|
|
573
|
-
world.
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
571
|
+
world.castRayApproximate(
|
|
572
|
+
(body) => console.log(body.position),
|
|
573
|
+
ray
|
|
574
|
+
); // logs 3 hits (unsorted)
|
|
577
575
|
```
|
|
578
576
|
|
|
579
577
|
### Shape Casting (Sweep Tests)
|
|
@@ -595,7 +593,7 @@ const capsule = Capsule.create({ radius: 1.0, length: 2.0 });
|
|
|
595
593
|
|
|
596
594
|
// sweep using displacement vector
|
|
597
595
|
world.castShape(
|
|
598
|
-
(result) => result.
|
|
596
|
+
(result) => result.bodyB.position,
|
|
599
597
|
capsule,
|
|
600
598
|
{ position: { x: 0, y: -10, z: 0 } },
|
|
601
599
|
{ x: 0, y: 15, z: 0 }, // displacement
|
|
@@ -604,7 +602,7 @@ world.castShape(
|
|
|
604
602
|
|
|
605
603
|
// sweep using end position
|
|
606
604
|
world.castShape(
|
|
607
|
-
(result) => result.
|
|
605
|
+
(result) => result.bodyB.position,
|
|
608
606
|
capsule,
|
|
609
607
|
{ position: { x: 0, y: -10, z: 0 } },
|
|
610
608
|
{ x: 0, y: 5, z: 0 }, // end position
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perplexdotgg/bounce",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Bounce",
|
|
6
6
|
"main": "./build/bounce.js",
|
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
"test": "vitest"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"monomorph": "^2.1
|
|
15
|
+
"monomorph": "^2.3.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/node": "^25.
|
|
18
|
+
"@types/node": "^25.2.3",
|
|
19
19
|
"ts-node": "^10.9.2",
|
|
20
20
|
"tslib": "^2.8.1",
|
|
21
21
|
"typescript": "^5.9.3",
|
|
22
|
-
"vite": "^
|
|
22
|
+
"vite": "^8.0.2",
|
|
23
23
|
"vite-plugin-conditional-compiler": "^0.4.0",
|
|
24
24
|
"vite-plugin-dts": "^4.5.4",
|
|
25
|
-
"vitest": "^4.
|
|
25
|
+
"vitest": "^4.1.1"
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
28
28
|
"repository": {
|
package/tsconfig.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"downlevelIteration": false,
|
|
4
3
|
"target": "ES2021",
|
|
5
4
|
"lib": ["dom", "dom.iterable", "ES2015", "ES2016", "ES2017", "ES2018", "ES2019", "ES2020", "ES2021", "ESnext"],
|
|
6
5
|
"declaration": true,
|
|
@@ -14,7 +13,8 @@
|
|
|
14
13
|
"moduleResolution": "bundler",
|
|
15
14
|
"outDir": "build",
|
|
16
15
|
"newLine": "lf",
|
|
17
|
-
"preserveConstEnums": true
|
|
16
|
+
"preserveConstEnums": true,
|
|
17
|
+
"rootDir": "src"
|
|
18
18
|
},
|
|
19
19
|
"include": ["src"]
|
|
20
20
|
}
|