@solidrt/flux-types 0.0.56 → 0.0.58
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/gui/spatial.d.ts +51 -3
- package/package.json +1 -1
package/gui/spatial.d.ts
CHANGED
|
@@ -148,10 +148,25 @@ declare module "flux:spatial" {
|
|
|
148
148
|
/** Free a shape; nodes still referencing it fall back to their box. */
|
|
149
149
|
export function destroyShape(shape: ShapeId): void
|
|
150
150
|
export function setShape(node: NodeId, shape: ShapeId | null): void
|
|
151
|
+
/** The node's layer membership bitmask (default 1), what a query's
|
|
152
|
+
* `layers` mask is tested against. Query-only: needs no flush. */
|
|
153
|
+
export function setLayers(node: NodeId, layers: number): void
|
|
154
|
+
/**
|
|
155
|
+
* The filter every query takes as its trailing argument, each field
|
|
156
|
+
* optional: `root` admits only the nodes under it (the caller's own
|
|
157
|
+
* subtree in the arena every scene and layer shares), `layers` only
|
|
158
|
+
* nodes whose mask intersects it (a node's mask of 0 then never
|
|
159
|
+
* reports), `nodes` only the listed ones. A dead root throws.
|
|
160
|
+
*/
|
|
161
|
+
export type QueryFilter = {
|
|
162
|
+
root?: NodeId
|
|
163
|
+
layers?: number
|
|
164
|
+
nodes?: NodeId[]
|
|
165
|
+
}
|
|
151
166
|
/** Every shown node with bounds the ray strikes, nearest first. The
|
|
152
167
|
* direction need not be normalized; distances are world units. Reads
|
|
153
168
|
* the index as of the last flush. */
|
|
154
|
-
export function raycast(origin: Float32Array, direction: Float32Array): Hit[]
|
|
169
|
+
export function raycast(origin: Float32Array, direction: Float32Array, filter?: QueryFilter): Hit[]
|
|
155
170
|
/** A query volume's layout for overlap/sweep: "capsule" is
|
|
156
171
|
* 7 floats (a, b, radius; a sphere when a == b), "box" is 10 (center,
|
|
157
172
|
* half extents, unit quaternion xyzw). */
|
|
@@ -184,7 +199,7 @@ declare module "flux:spatial" {
|
|
|
184
199
|
* with no triangle in reach touches nothing. Unordered; reads the index
|
|
185
200
|
* as of the last flush, like raycast.
|
|
186
201
|
*/
|
|
187
|
-
export function overlap(kind: VolumeKind, volume: Float32Array): Overlap[]
|
|
202
|
+
export function overlap(kind: VolumeKind, volume: Float32Array, filter?: QueryFilter): Overlap[]
|
|
188
203
|
/**
|
|
189
204
|
* The volume moved by `motion` (a Float32Array of 3): every shown node
|
|
190
205
|
* with bounds it touches on the way, at its first touch, earliest
|
|
@@ -193,7 +208,40 @@ declare module "flux:spatial" {
|
|
|
193
208
|
* a zero motion touches nothing. Same testing and index contract as
|
|
194
209
|
* overlap.
|
|
195
210
|
*/
|
|
196
|
-
export function sweep(kind: VolumeKind, volume: Float32Array, motion: Float32Array): Impact[]
|
|
211
|
+
export function sweep(kind: VolumeKind, volume: Float32Array, motion: Float32Array, filter?: QueryFilter): Impact[]
|
|
212
|
+
/** The mover's tuning, every field optional over the core's defaults:
|
|
213
|
+
* `up` (the direction floors face, [0, 1, 0]), `floorMaxAngle` (radians
|
|
214
|
+
* from `up` a contact still counts as floor, 45 degrees), `maxSlides`
|
|
215
|
+
* (6), `skin` (the gap kept from every surface, 0.01) and `floorSnap`
|
|
216
|
+
* (how far below a floor is pulled to when the motion does not rise,
|
|
217
|
+
* 0.1; 0 disables). */
|
|
218
|
+
export type MoveOptions = {
|
|
219
|
+
up?: [number, number, number]
|
|
220
|
+
floorMaxAngle?: number
|
|
221
|
+
maxSlides?: number
|
|
222
|
+
skin?: number
|
|
223
|
+
floorSnap?: number
|
|
224
|
+
}
|
|
225
|
+
/** What moveAndSlide() returns: the displacement the body gets, the
|
|
226
|
+
* unit normal of the floor it ends on (null when airborne or on a slope
|
|
227
|
+
* too steep to stand on), whether a wall or a ceiling was met, and
|
|
228
|
+
* every impact in order, the floor snap's last. */
|
|
229
|
+
export type MoveResult = {
|
|
230
|
+
motion: [number, number, number]
|
|
231
|
+
floor: [number, number, number] | null
|
|
232
|
+
wall: boolean
|
|
233
|
+
ceiling: boolean
|
|
234
|
+
hits: Impact[]
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Move the volume by `motion` through the admitted nodes, sliding along
|
|
238
|
+
* what it hits (Godot's move_and_slide, Unity's CharacterController.Move
|
|
239
|
+
* as one pure call): a push out of anything it starts inside, then
|
|
240
|
+
* sweep, stop a skin short, slide the rest along the contact, up to
|
|
241
|
+
* `maxSlides` times, then unless the motion rises a snap down onto a
|
|
242
|
+
* floor within `floorSnap`. Same index and filter contract as sweep.
|
|
243
|
+
*/
|
|
244
|
+
export function moveAndSlide(kind: VolumeKind, volume: Float32Array, motion: Float32Array, opts?: MoveOptions, filter?: QueryFilter): MoveResult
|
|
197
245
|
|
|
198
246
|
/**
|
|
199
247
|
* Route the world DIRECTION of the node's local `vector` (a
|