@vibe-engine/3d 0.1.2 → 0.1.3
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/dist/query.d.ts +2 -0
- package/dist/query.js +2 -2
- package/package.json +2 -2
package/dist/query.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ interface QueryBase {
|
|
|
11
11
|
filter?: (e: EntityRef) => boolean;
|
|
12
12
|
/** Jogador que fez a ação: no multiplayer, liga a lag compensation. */
|
|
13
13
|
by?: string;
|
|
14
|
+
/** Com `by`: nome estável da consulta (ex.: o id da bala, que varre o caminho a cada tick). Projéteis devem passar. */
|
|
15
|
+
key?: string;
|
|
14
16
|
}
|
|
15
17
|
export interface Raycast3DOptions extends QueryBase {
|
|
16
18
|
from: Vec3;
|
package/dist/query.js
CHANGED
|
@@ -166,7 +166,7 @@ export function raycast3D(world, opts) {
|
|
|
166
166
|
if (wall && (!best || wall.t < best.distance))
|
|
167
167
|
best = { entity: wall.id, at: { ...world.entity(wall.id).read(Transform3D).position }, point: add(opts.from, mul(d, wall.t)), distance: wall.t, normal: wall.n };
|
|
168
168
|
return best ? [best] : [];
|
|
169
|
-
});
|
|
169
|
+
}, opts.key);
|
|
170
170
|
return hits[0] ?? null;
|
|
171
171
|
}
|
|
172
172
|
function closestPoint(p, s) {
|
|
@@ -214,5 +214,5 @@ export function overlap3D(world, opts) {
|
|
|
214
214
|
out.push({ entity: t.id, at: t.at, point, distance });
|
|
215
215
|
}
|
|
216
216
|
return out.sort((a, b) => a.distance - b.distance);
|
|
217
|
-
});
|
|
217
|
+
}, opts.key);
|
|
218
218
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-engine/3d",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "vibe-engine 3D: transforms, Rapier physics, meshes, models, block grids, instant queries",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@dimforge/rapier3d-deterministic-compat": "0.21.0",
|
|
32
|
-
"@vibe-engine/core": "0.1.
|
|
32
|
+
"@vibe-engine/core": "0.1.3"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"dist",
|