@defold-typescript/types 0.39.0 → 0.41.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/api-availability.json +4024 -716
- package/api-migrations.json +27 -0
- package/api-signatures.json +18118 -10264
- package/api-targets.json +448 -11
- package/examples/translations.json +619 -148
- package/fixtures/messages_doc.json +96 -0
- package/generated/b2d.d.ts +680 -4
- package/generated/b2d_body.d.ts +29 -103
- package/generated/b2d_chain.d.ts +5 -6
- package/generated/b2d_fixture.d.ts +34 -38
- package/generated/b2d_joint.d.ts +503 -25
- package/generated/b2d_shape.d.ts +199 -14
- package/generated/b2d_world.d.ts +57 -63
- package/generated/buffer.d.ts +33 -29
- package/generated/builtin-messages.d.ts +7 -1
- package/generated/bullet3d.d.ts +91 -0
- package/generated/bullet3d_collision_object.d.ts +433 -0
- package/generated/bullet3d_constraint.d.ts +818 -0
- package/generated/bullet3d_rigid_body.d.ts +429 -0
- package/generated/bullet3d_shape.d.ts +123 -0
- package/generated/bullet3d_world.d.ts +492 -0
- package/generated/camera.d.ts +31 -34
- package/generated/collectionfactory.d.ts +26 -27
- package/generated/collectionproxy.d.ts +22 -6
- package/generated/compute.d.ts +12 -238
- package/generated/crash.d.ts +24 -10
- package/generated/editor-vm/http.d.ts +90 -7
- package/generated/editor-vm/image.d.ts +7 -7
- package/generated/editor-vm/json.d.ts +11 -0
- package/generated/editor-vm/localization.d.ts +7 -7
- package/generated/editor-vm/tilemap_tiles.d.ts +56 -10
- package/generated/editor-vm/zip.d.ts +28 -0
- package/generated/editor.d.ts +1496 -430
- package/generated/factory.d.ts +21 -25
- package/generated/font.d.ts +64 -22
- package/generated/go.d.ts +243 -186
- package/generated/graphics.d.ts +374 -84
- package/generated/gui.d.ts +282 -492
- package/generated/html5.d.ts +5 -3
- package/generated/http.d.ts +31 -36
- package/generated/image.d.ts +127 -85
- package/generated/json.d.ts +34 -16
- package/generated/kinds/gui-script.d.ts +8 -0
- package/generated/kinds/render-script.d.ts +8 -0
- package/generated/kinds/script.d.ts +8 -0
- package/generated/label.d.ts +77 -7
- package/generated/liveupdate.d.ts +13 -10
- package/generated/material.d.ts +312 -360
- package/generated/model.d.ts +72 -42
- package/generated/particlefx.d.ts +19 -28
- package/generated/physics.d.ts +378 -144
- package/generated/profiler.d.ts +14 -24
- package/generated/render.d.ts +294 -297
- package/generated/resource.d.ts +753 -641
- package/generated/socket.d.ts +131 -134
- package/generated/sound.d.ts +65 -34
- package/generated/sprite.d.ts +39 -17
- package/generated/sys.d.ts +237 -182
- package/generated/tilemap.d.ts +21 -16
- package/generated/timer.d.ts +34 -21
- package/generated/versions/defold-1.12.4/b2d_body.d.ts +0 -7
- package/generated/versions/defold-1.12.4/buffer.d.ts +18 -17
- package/generated/versions/defold-1.12.4/camera.d.ts +23 -23
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +21 -19
- package/generated/versions/defold-1.12.4/collectionproxy.d.ts +2 -2
- package/generated/versions/defold-1.12.4/crash.d.ts +2 -2
- package/generated/versions/defold-1.12.4/factory.d.ts +15 -16
- package/generated/versions/defold-1.12.4/go.d.ts +15 -17
- package/generated/versions/defold-1.12.4/gui.d.ts +111 -193
- package/generated/versions/defold-1.12.4/html5.d.ts +4 -2
- package/generated/versions/defold-1.12.4/http.d.ts +4 -15
- package/generated/versions/defold-1.12.4/image.d.ts +38 -46
- package/generated/versions/defold-1.12.4/index.d.ts +2 -0
- package/generated/versions/defold-1.12.4/json.d.ts +10 -6
- package/generated/versions/defold-1.12.4/label.d.ts +2 -3
- package/generated/versions/defold-1.12.4/liveupdate.d.ts +5 -3
- package/generated/versions/defold-1.12.4/model.d.ts +34 -13
- package/generated/versions/defold-1.12.4/particlefx.d.ts +2 -5
- package/generated/versions/defold-1.12.4/physics.d.ts +82 -78
- package/generated/versions/defold-1.12.4/profiler.d.ts +3 -6
- package/generated/versions/defold-1.12.4/render.d.ts +160 -132
- package/generated/versions/defold-1.12.4/resource.d.ts +212 -209
- package/generated/versions/defold-1.12.4/socket.d.ts +45 -61
- package/generated/versions/defold-1.12.4/sound.d.ts +11 -11
- package/generated/versions/defold-1.12.4/sprite.d.ts +24 -6
- package/generated/versions/defold-1.12.4/sys.d.ts +45 -68
- package/generated/versions/defold-1.12.4/tilemap.d.ts +18 -11
- package/generated/versions/defold-1.12.4/timer.d.ts +5 -3
- package/generated/versions/defold-1.12.4/vmath.d.ts +5 -26
- package/generated/versions/defold-1.12.4/window.d.ts +1 -16
- package/generated/versions/defold-1.13.0/b2d_body.d.ts +10 -55
- package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +25 -25
- package/generated/versions/defold-1.13.0/b2d_shape.d.ts +188 -5
- package/generated/versions/defold-1.13.0/b2d_world.d.ts +16 -10
- package/generated/versions/defold-1.13.0/buffer.d.ts +18 -17
- package/generated/versions/defold-1.13.0/camera.d.ts +27 -27
- package/generated/versions/defold-1.13.0/collectionfactory.d.ts +21 -19
- package/generated/versions/defold-1.13.0/collectionproxy.d.ts +2 -2
- package/generated/versions/defold-1.13.0/compute.d.ts +1 -70
- package/generated/versions/defold-1.13.0/crash.d.ts +2 -2
- package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +3 -3
- package/generated/versions/defold-1.13.0/editor.d.ts +34 -24
- package/generated/versions/defold-1.13.0/factory.d.ts +15 -16
- package/generated/versions/defold-1.13.0/go.d.ts +15 -17
- package/generated/versions/defold-1.13.0/graphics.d.ts +121 -37
- package/generated/versions/defold-1.13.0/gui.d.ts +111 -193
- package/generated/versions/defold-1.13.0/html5.d.ts +4 -2
- package/generated/versions/defold-1.13.0/http.d.ts +4 -15
- package/generated/versions/defold-1.13.0/image.d.ts +38 -46
- package/generated/versions/defold-1.13.0/index.d.ts +2 -0
- package/generated/versions/defold-1.13.0/json.d.ts +10 -6
- package/generated/versions/defold-1.13.0/label.d.ts +2 -3
- package/generated/versions/defold-1.13.0/liveupdate.d.ts +7 -5
- package/generated/versions/defold-1.13.0/material.d.ts +69 -107
- package/generated/versions/defold-1.13.0/model.d.ts +34 -13
- package/generated/versions/defold-1.13.0/particlefx.d.ts +2 -5
- package/generated/versions/defold-1.13.0/physics.d.ts +82 -78
- package/generated/versions/defold-1.13.0/profiler.d.ts +3 -6
- package/generated/versions/defold-1.13.0/render.d.ts +160 -132
- package/generated/versions/defold-1.13.0/resource.d.ts +217 -210
- package/generated/versions/defold-1.13.0/socket.d.ts +45 -61
- package/generated/versions/defold-1.13.0/sound.d.ts +11 -11
- package/generated/versions/defold-1.13.0/sprite.d.ts +24 -6
- package/generated/versions/defold-1.13.0/sys.d.ts +45 -68
- package/generated/versions/defold-1.13.0/tilemap.d.ts +18 -11
- package/generated/versions/defold-1.13.0/timer.d.ts +5 -3
- package/generated/versions/defold-1.13.0/vmath.d.ts +5 -26
- package/generated/versions/defold-1.13.0/window.d.ts +1 -16
- package/generated/versions/defold-1.13.1/b2d.d.ts +33 -0
- package/generated/versions/defold-1.13.1/b2d_body.d.ts +636 -0
- package/generated/versions/defold-1.13.1/b2d_chain.d.ts +106 -0
- package/generated/versions/defold-1.13.1/b2d_fixture.d.ts +157 -0
- package/generated/versions/defold-1.13.1/b2d_joint.d.ts +823 -0
- package/generated/versions/defold-1.13.1/b2d_shape.d.ts +400 -0
- package/generated/versions/defold-1.13.1/b2d_world.d.ts +320 -0
- package/generated/versions/defold-1.13.1/buffer.d.ts +189 -0
- package/generated/versions/defold-1.13.1/camera.d.ts +303 -0
- package/generated/versions/defold-1.13.1/collectionfactory.d.ts +151 -0
- package/generated/versions/defold-1.13.1/collectionproxy.d.ts +93 -0
- package/generated/versions/defold-1.13.1/compute.d.ts +237 -0
- package/generated/versions/defold-1.13.1/crash.d.ts +143 -0
- package/generated/versions/defold-1.13.1/editor-vm/http.d.ts +56 -0
- package/generated/versions/defold-1.13.1/editor-vm/image.d.ts +48 -0
- package/generated/versions/defold-1.13.1/editor-vm/json.d.ts +10 -0
- package/generated/versions/defold-1.13.1/editor-vm/localization.d.ts +42 -0
- package/generated/versions/defold-1.13.1/editor-vm/tilemap_tiles.d.ts +80 -0
- package/generated/versions/defold-1.13.1/editor-vm/zip.d.ts +10 -0
- package/generated/versions/defold-1.13.1/editor-vm/zlib.d.ts +24 -0
- package/generated/versions/defold-1.13.1/editor.d.ts +1121 -0
- package/generated/versions/defold-1.13.1/factory.d.ts +124 -0
- package/generated/versions/defold-1.13.1/font.d.ts +81 -0
- package/generated/versions/defold-1.13.1/go.d.ts +1107 -0
- package/generated/versions/defold-1.13.1/graphics.d.ts +411 -0
- package/generated/versions/defold-1.13.1/gui.d.ts +2353 -0
- package/generated/versions/defold-1.13.1/html5.d.ts +55 -0
- package/generated/versions/defold-1.13.1/http.d.ts +77 -0
- package/generated/versions/defold-1.13.1/image.d.ts +131 -0
- package/generated/versions/defold-1.13.1/index.d.ts +57 -0
- package/generated/versions/defold-1.13.1/json.d.ts +80 -0
- package/generated/versions/defold-1.13.1/kinds/editor-script.d.ts +14 -0
- package/generated/versions/defold-1.13.1/label.d.ts +93 -0
- package/generated/versions/defold-1.13.1/liveupdate.d.ts +142 -0
- package/generated/versions/defold-1.13.1/material.d.ts +408 -0
- package/generated/versions/defold-1.13.1/model.d.ts +272 -0
- package/generated/versions/defold-1.13.1/msg.d.ts +10 -0
- package/generated/versions/defold-1.13.1/particlefx.d.ts +163 -0
- package/generated/versions/defold-1.13.1/physics.d.ts +559 -0
- package/generated/versions/defold-1.13.1/profiler.d.ts +235 -0
- package/generated/versions/defold-1.13.1/render.d.ts +1190 -0
- package/generated/versions/defold-1.13.1/resource.d.ts +1523 -0
- package/generated/versions/defold-1.13.1/socket.d.ts +784 -0
- package/generated/versions/defold-1.13.1/sound.d.ts +292 -0
- package/generated/versions/defold-1.13.1/sprite.d.ts +175 -0
- package/generated/versions/defold-1.13.1/sys.d.ts +678 -0
- package/generated/versions/defold-1.13.1/tilemap.d.ts +208 -0
- package/generated/versions/defold-1.13.1/timer.d.ts +125 -0
- package/generated/versions/defold-1.13.1/types.d.ts +61 -0
- package/generated/versions/defold-1.13.1/vmath.d.ts +774 -0
- package/generated/versions/defold-1.13.1/window.d.ts +183 -0
- package/generated/versions/defold-1.13.1/zlib.d.ts +41 -0
- package/generated/vmath.d.ts +6 -26
- package/generated/window.d.ts +71 -71
- package/identity-vocabulary.json +561 -0
- package/index.d.ts +8 -0
- package/package.json +13 -2
- package/scripts/example-store-io.ts +12 -1
- package/scripts/extension-goldens.ts +1 -0
- package/scripts/fidelity-baseline.json +146 -46
- package/scripts/generate-api-availability.ts +90 -12
- package/scripts/generate-api-signatures.ts +14 -3
- package/scripts/import-defold-release.ts +85 -24
- package/scripts/prose-constants.ts +157 -0
- package/scripts/regen.ts +396 -78
- package/scripts/shared-handle-methods.ts +53 -0
- package/scripts/signature-store-fs.ts +1 -0
- package/scripts/sync-api-docs.ts +16 -5
- package/src/api-availability.ts +0 -0
- package/src/api-doc.ts +201 -3
- package/src/api-identity.ts +252 -0
- package/src/component-properties.d.ts +33 -0
- package/src/core-types.ts +28 -3
- package/src/correction-pins.ts +49 -0
- package/src/custom-messages.d.ts +4 -3
- package/src/doc-comment.ts +139 -23
- package/src/doc-corrections.ts +108 -0
- package/src/editor-vm-globals.d.ts +5 -2
- package/src/emit-dts.ts +2474 -281
- package/src/emit-messages.ts +52 -0
- package/src/engine-globals.d.ts +2 -2
- package/src/example-store.ts +125 -14
- package/src/field-correction-coverage.ts +204 -0
- package/src/fnv1a.ts +16 -0
- package/src/go-overloads.d.ts +33 -13
- package/src/index-base-table.ts +145 -0
- package/src/index-slot-classifications.ts +588 -0
- package/src/index.ts +39 -2
- package/src/library-index-slot-classifications.ts +332 -0
- package/src/lifecycle.ts +61 -199
- package/src/luals-type-expr.ts +354 -0
- package/src/msg-overloads.d.ts +0 -1
- package/src/param-correction-provenance.ts +64 -0
- package/src/return-correction-provenance.ts +58 -16
- package/src/script-api.ts +3 -1
- package/src/sys-overloads.d.ts +48 -0
- package/src/vmath-overloads.d.ts +27 -1
- package/src/window-event-guard.d.ts +6 -9
- package/url-parameters.json +1 -2
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import type { Opaque, Vector3 } from "../src/core-types";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Read and tune the Bullet dynamics world owned by the current collection.
|
|
7
|
+
* Defold remains responsible for world lifetime, stepping, collision objects,
|
|
8
|
+
* callbacks, and debug drawing.
|
|
9
|
+
*
|
|
10
|
+
* World and collision-object values returned by this API are borrowed,
|
|
11
|
+
* generational handles. They become invalid when their collection or owning
|
|
12
|
+
* game object is deleted and must not be retained as native pointers.
|
|
13
|
+
*
|
|
14
|
+
* All positions, distances, translations, dimensions and contact distances use
|
|
15
|
+
* Defold world units. The binding converts them using `physics.scale`. Rotations
|
|
16
|
+
* and unit normals are not scaled. Query functions refresh Bullet broadphase
|
|
17
|
+
* AABBs before execution, so collision-object transform changes are visible.
|
|
18
|
+
*
|
|
19
|
+
* Query filters are optional tables with these fields:
|
|
20
|
+
*
|
|
21
|
+
* `category_bits`
|
|
22
|
+
* : [type:integer] unsigned 16-bit category bits, default `65535`
|
|
23
|
+
*
|
|
24
|
+
* `mask_bits`
|
|
25
|
+
* : [type:integer] unsigned 16-bit mask bits, default `65535`
|
|
26
|
+
*
|
|
27
|
+
* `include_triggers`
|
|
28
|
+
* : [type:boolean] include objects without contact response, default `true`
|
|
29
|
+
*
|
|
30
|
+
* `ignore`
|
|
31
|
+
* : [type:btCollisionObject|btCollisionObject[]] one collision-object handle or an array of handles to exclude
|
|
32
|
+
*
|
|
33
|
+
* `report_initial_overlaps`
|
|
34
|
+
* : [type:boolean] report shapes overlapping the cast origin as synthesized fraction-zero hits, default `false`
|
|
35
|
+
*
|
|
36
|
+
* `report_initial_overlaps` is a `bullet3d.world` query option only. It does
|
|
37
|
+
* not change `physics.raycast()` or either Box2D backend.
|
|
38
|
+
*
|
|
39
|
+
* Category and mask checks are reciprocal: the query category must match the
|
|
40
|
+
* object's mask and the object's category must match the query mask.
|
|
41
|
+
*
|
|
42
|
+
* Temporary query shapes use the same geometry fields as
|
|
43
|
+
* [ref:bullet3d.shape.get_shape]:
|
|
44
|
+
* a sphere has `type` and `diameter`, a box has `type` and `dimensions`, a
|
|
45
|
+
* Y-axis capsule has `type`, `diameter` and `height`, and a convex hull has
|
|
46
|
+
* `type` and a `vertices` array with at least four `vector3` values. The `type`
|
|
47
|
+
* is one of the `bullet3d.shape.SHAPE_TYPE_*` constants. Every shape can specify
|
|
48
|
+
* `position` and `rotation`; their defaults are zero and the identity rotation.
|
|
49
|
+
* Cast shapes can also specify `target_rotation`, which defaults to `rotation`.
|
|
50
|
+
* Capsule `height` is the length of the cylindrical middle section; total
|
|
51
|
+
* end-to-end height is `height + diameter`. Query sizes are always expressed
|
|
52
|
+
* in Defold world units. Except for triangle meshes, a table returned by
|
|
53
|
+
* `bullet3d.shape.get_shape` can be reused directly after adding the desired
|
|
54
|
+
* query transform fields. Queries accept only sphere, box, capsule, and hull.
|
|
55
|
+
* Hull vertices describe a convex hull; concave input is convexified by Bullet.
|
|
56
|
+
* All query vectors and scalar sizes must be finite. Diameters, dimensions and
|
|
57
|
+
* capsule heights must be greater than zero; hulls require at least four finite
|
|
58
|
+
* vertices. Cast translations must be finite and non-zero. Query rotations
|
|
59
|
+
* must be finite, non-zero quaternions and are normalized by the binding. AABB
|
|
60
|
+
* lower bounds must not exceed their corresponding upper bounds.
|
|
61
|
+
*
|
|
62
|
+
* Overlap and enumeration results are arrays of `btCollisionObject` handles.
|
|
63
|
+
* Cast results are tables containing `object`, `point`, `normal`, `fraction`,
|
|
64
|
+
* `initial_overlap`, and `inside`. `shape_index` is present when Bullet reports
|
|
65
|
+
* a compound child and is one-based. Cast arrays are sorted by ascending
|
|
66
|
+
* fraction. `fraction` is in `[0, 1]` along the supplied translation. For native
|
|
67
|
+
* hits, `normal` is the hit object's outward unit surface normal; synthesized
|
|
68
|
+
* initial-overlap hits use a zero normal. `inside` is true for a synthesized
|
|
69
|
+
* ray-origin hit when Bullet reports signed contact distance less than or equal
|
|
70
|
+
* to zero. It denotes initial contact or penetration rather than strict
|
|
71
|
+
* geometric containment, and exact-surface cases follow Bullet's contact
|
|
72
|
+
* tolerance. Shape-cast initial overlaps set only `initial_overlap`.
|
|
73
|
+
*
|
|
74
|
+
* Contact results contain `object_a`, `object_b`, `position_a`, `position_b`,
|
|
75
|
+
* `normal_on_b`, and signed `distance`. Positions are points on their named
|
|
76
|
+
* objects, and `normal_on_b` points from object B toward object A. A negative
|
|
77
|
+
* distance is penetration and a small positive distance is Bullet's contact
|
|
78
|
+
* margin. Object order is always normalized to the order supplied by the caller.
|
|
79
|
+
*
|
|
80
|
+
* `max_results` is optional. Zero or omission means unlimited results. A
|
|
81
|
+
* negative value is an error. Broadphase overlaps, native world enumeration,
|
|
82
|
+
* contacts, and equal-fraction cast hits have unspecified order. A capped query
|
|
83
|
+
* can therefore return a different equal-priority subset after world changes.
|
|
84
|
+
* Synchronous queries execute immediately and do not advance simulation.
|
|
85
|
+
* Async casts are deferred until after the next physics step. They execute on
|
|
86
|
+
* the main thread rather than a worker thread, and all queued casts for one
|
|
87
|
+
* world share one broadphase AABB refresh. Every cast in the batch completes
|
|
88
|
+
* before any callback runs, so callback mutations cannot affect other query
|
|
89
|
+
* computations in that batch. Deferral avoids blocking the Lua call site but
|
|
90
|
+
* does not remove the cast work from the frame.
|
|
91
|
+
* Native fraction-zero cast callbacks are suppressed. Starting overlaps are
|
|
92
|
+
* omitted by default, or reported through the exact, deduplicated synthesis
|
|
93
|
+
* enabled by `report_initial_overlaps`; this avoids direction-dependent Bullet
|
|
94
|
+
* results for casts that start touching or penetrating another object.
|
|
95
|
+
*/
|
|
96
|
+
namespace bullet3d.world {
|
|
97
|
+
/**
|
|
98
|
+
* Bullet world axis-aligned bounding box
|
|
99
|
+
*/
|
|
100
|
+
interface aabb {
|
|
101
|
+
/**
|
|
102
|
+
* lower world-space bound in Defold units
|
|
103
|
+
*/
|
|
104
|
+
lower: Vector3;
|
|
105
|
+
/**
|
|
106
|
+
* upper world-space bound in Defold units
|
|
107
|
+
*/
|
|
108
|
+
upper: Vector3;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Bullet world cast result
|
|
112
|
+
*/
|
|
113
|
+
interface cast_result {
|
|
114
|
+
/**
|
|
115
|
+
* hit collision object
|
|
116
|
+
*/
|
|
117
|
+
object: Opaque<"btCollisionObject" | "btRigidBody">;
|
|
118
|
+
/**
|
|
119
|
+
* hit point in world space and Defold units
|
|
120
|
+
*/
|
|
121
|
+
point: Vector3;
|
|
122
|
+
/**
|
|
123
|
+
* outward unit surface normal
|
|
124
|
+
*/
|
|
125
|
+
normal: Vector3;
|
|
126
|
+
/**
|
|
127
|
+
* fraction along the supplied translation in `[0, 1]`
|
|
128
|
+
*/
|
|
129
|
+
fraction: number;
|
|
130
|
+
/**
|
|
131
|
+
* one-based compound child index
|
|
132
|
+
*/
|
|
133
|
+
shape_index?: number;
|
|
134
|
+
/**
|
|
135
|
+
* whether the hit was synthesized from an initial overlap
|
|
136
|
+
*/
|
|
137
|
+
initial_overlap: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* whether a synthesized ray-origin hit starts inside the object
|
|
140
|
+
*/
|
|
141
|
+
inside: boolean;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Bullet world contact result
|
|
145
|
+
*/
|
|
146
|
+
interface contact_result {
|
|
147
|
+
/**
|
|
148
|
+
* first collision object
|
|
149
|
+
*/
|
|
150
|
+
object_a: Opaque<"btCollisionObject" | "btRigidBody">;
|
|
151
|
+
/**
|
|
152
|
+
* second collision object
|
|
153
|
+
*/
|
|
154
|
+
object_b: Opaque<"btCollisionObject" | "btRigidBody">;
|
|
155
|
+
/**
|
|
156
|
+
* contact point on object A in world space and Defold units
|
|
157
|
+
*/
|
|
158
|
+
position_a: Vector3;
|
|
159
|
+
/**
|
|
160
|
+
* contact point on object B in world space and Defold units
|
|
161
|
+
*/
|
|
162
|
+
position_b: Vector3;
|
|
163
|
+
/**
|
|
164
|
+
* unit normal pointing from object B toward object A
|
|
165
|
+
*/
|
|
166
|
+
normal_on_b: Vector3;
|
|
167
|
+
/**
|
|
168
|
+
* signed contact distance in Defold units
|
|
169
|
+
*/
|
|
170
|
+
distance: number;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Bullet world query filter
|
|
174
|
+
*/
|
|
175
|
+
interface query_filter {
|
|
176
|
+
/**
|
|
177
|
+
* unsigned 16-bit category bits; defaults to `65535`
|
|
178
|
+
*/
|
|
179
|
+
category_bits?: number;
|
|
180
|
+
/**
|
|
181
|
+
* unsigned 16-bit mask bits; defaults to `65535`
|
|
182
|
+
*/
|
|
183
|
+
mask_bits?: number;
|
|
184
|
+
/**
|
|
185
|
+
* whether to include objects without contact response; defaults to `true`
|
|
186
|
+
*/
|
|
187
|
+
include_triggers?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* one collision object or an array of collision objects to exclude
|
|
190
|
+
*/
|
|
191
|
+
ignore?: Opaque<"btCollisionObject" | "btRigidBody"> | Opaque<"btCollisionObject" | "btRigidBody">[];
|
|
192
|
+
/**
|
|
193
|
+
* whether casts synthesize fraction-zero hits for initial overlaps; defaults to `false`
|
|
194
|
+
*/
|
|
195
|
+
report_initial_overlaps?: boolean;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Casts immediately from `origin` to `origin + translation` and returns all
|
|
199
|
+
* matching hits sorted by fraction. Translation must be non-zero.
|
|
200
|
+
* Bullet's convex ray test normally does not report a ray whose start and end are both inside
|
|
201
|
+
* the same convex hull. Set `filter.report_initial_overlaps = true` to perform
|
|
202
|
+
* an exact point-overlap test at the origin and synthesize one deduplicated hit
|
|
203
|
+
* per initially touching or overlapping object with `fraction = 0`, zero `normal`,
|
|
204
|
+
* `point = origin`, `initial_overlap = true`, and `inside = true`. The point is
|
|
205
|
+
* the query origin, not a surface contact. This explicitly supports the
|
|
206
|
+
* inside-hull behavior requested by issue #5348. Fraction-zero native callbacks
|
|
207
|
+
* and starting overlaps are suppressed when the option is false.
|
|
208
|
+
*
|
|
209
|
+
* @param world - world handle
|
|
210
|
+
* @param origin - ray origin in world space
|
|
211
|
+
* @param translation - non-zero ray displacement in world units
|
|
212
|
+
* @param filter - query filter
|
|
213
|
+
* @param max_results - maximum sorted hits, or zero for all
|
|
214
|
+
* @returns cast results sorted by ascending fraction. **⚠️ `shape_index` is 1-based; passed to Defold unchanged.**
|
|
215
|
+
*/
|
|
216
|
+
function cast_ray(world: bullet3d.btDiscreteDynamicsWorld, origin: Vector3, translation: Vector3, filter?: bullet3d.world.query_filter, max_results?: number): bullet3d.world.cast_result[];
|
|
217
|
+
/**
|
|
218
|
+
* Queues the same ray query as bullet3d.world.cast_ray and returns without
|
|
219
|
+
* executing it. After the next physics step, `callback(self, hits)` receives the
|
|
220
|
+
* cast-result array sorted by fraction. The query observes post-step world state.
|
|
221
|
+
* It is deferred on the main thread, not executed concurrently; use it to move
|
|
222
|
+
* work out of the current Lua call and to query the stepped state, not as a
|
|
223
|
+
* guarantee of lower total CPU time. Queued casts for the same world share one
|
|
224
|
+
* broadphase AABB refresh and all finish before their callbacks begin.
|
|
225
|
+
*
|
|
226
|
+
* @param world - world handle
|
|
227
|
+
* @param origin - ray origin in world space
|
|
228
|
+
* @param translation - non-zero ray displacement in world units
|
|
229
|
+
* @param callback - function called as `callback(self, hits)`
|
|
230
|
+
* @param filter - query filter
|
|
231
|
+
* @param max_results - maximum sorted hits, or zero for all
|
|
232
|
+
* @example
|
|
233
|
+
* ```ts
|
|
234
|
+
* // Queue a downward cast and inspect only the closest non-trigger hit:
|
|
235
|
+
* const world = bullet3d.get_world();
|
|
236
|
+
* if (world !== undefined) {
|
|
237
|
+
* bullet3d.world.cast_ray_async(
|
|
238
|
+
* world,
|
|
239
|
+
* go.get_world_position(),
|
|
240
|
+
* vmath.vector3(0, -100, 0),
|
|
241
|
+
* (self, hits) => {
|
|
242
|
+
* const hit = hits[0];
|
|
243
|
+
* if (hit !== undefined) {
|
|
244
|
+
* print("hit", hit.object);
|
|
245
|
+
* }
|
|
246
|
+
* },
|
|
247
|
+
* { include_triggers: false },
|
|
248
|
+
* 1,
|
|
249
|
+
* );
|
|
250
|
+
* }
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
function cast_ray_async(world: bullet3d.btDiscreteDynamicsWorld, origin: Vector3, translation: Vector3, callback: (self: unknown, hits: bullet3d.world.cast_result[]) => void, filter?: bullet3d.world.query_filter, max_results?: number): void;
|
|
254
|
+
/**
|
|
255
|
+
* Equivalent to bullet3d.world.cast_ray with one result, but returns the
|
|
256
|
+
* hit table directly or `nil` on a miss.
|
|
257
|
+
*
|
|
258
|
+
* @param world - world handle
|
|
259
|
+
* @param origin - ray origin in world space
|
|
260
|
+
* @param translation - non-zero ray displacement in world units
|
|
261
|
+
* @param filter - query filter
|
|
262
|
+
* @returns closest cast result, or `nil` on a miss. **⚠️ `shape_index` is 1-based; passed to Defold unchanged.**
|
|
263
|
+
* @example
|
|
264
|
+
* ```ts
|
|
265
|
+
* // Cast downward and report the closest non-trigger hit:
|
|
266
|
+
* export default defineScript({
|
|
267
|
+
* init() {
|
|
268
|
+
* const world = bullet3d.get_world();
|
|
269
|
+
* if (world === undefined) return;
|
|
270
|
+
* const origin = go.get_world_position();
|
|
271
|
+
* const translation = vmath.vector3(0, -100, 0);
|
|
272
|
+
* const filter = { include_triggers: false };
|
|
273
|
+
*
|
|
274
|
+
* const hit = bullet3d.world.cast_ray_closest(world, origin, translation, filter);
|
|
275
|
+
* if (hit !== undefined) {
|
|
276
|
+
* const distance = vmath.length(translation) * hit.fraction;
|
|
277
|
+
* print("hit", hit.object, "after", distance, "units");
|
|
278
|
+
* }
|
|
279
|
+
* },
|
|
280
|
+
* });
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
function cast_ray_closest(world: bullet3d.btDiscreteDynamicsWorld, origin: Vector3, translation: Vector3, filter?: bullet3d.world.query_filter): bullet3d.world.cast_result | undefined;
|
|
284
|
+
/**
|
|
285
|
+
* Sweeps the temporary shape from `shape.position` by `translation`, while
|
|
286
|
+
* interpolating from `shape.rotation` to `shape.target_rotation`. Translation
|
|
287
|
+
* must be non-zero. The query executes immediately and returns all matching hits
|
|
288
|
+
* sorted by fraction. Bullet's convex sweep supports only convex query shapes.
|
|
289
|
+
* When `filter.report_initial_overlaps` is true, an exact contact test at the
|
|
290
|
+
* starting transform synthesizes one deduplicated hit per overlapping object
|
|
291
|
+
* with `fraction = 0`, `point = shape.position`, zero `normal`,
|
|
292
|
+
* `initial_overlap = true`, and `inside = false`. The point is the query-shape
|
|
293
|
+
* origin, not a surface contact, and the result does not report penetration depth.
|
|
294
|
+
*
|
|
295
|
+
* @param world - world handle
|
|
296
|
+
* @param shape - convex query shape with optional target rotation
|
|
297
|
+
* @param translation - non-zero sweep displacement in world units
|
|
298
|
+
* @param filter - query filter
|
|
299
|
+
* @param max_results - maximum sorted hits, or zero for all
|
|
300
|
+
* @returns cast results sorted by ascending fraction. **⚠️ `shape_index` is 1-based; passed to Defold unchanged.**
|
|
301
|
+
*/
|
|
302
|
+
function cast_shape(world: bullet3d.btDiscreteDynamicsWorld, shape: bullet3d.shape.definition, translation: Vector3, filter?: bullet3d.world.query_filter, max_results?: number): bullet3d.world.cast_result[];
|
|
303
|
+
/**
|
|
304
|
+
* Queues the same convex sweep as bullet3d.world.cast_shape and returns
|
|
305
|
+
* without executing it. After the next physics step, `callback(self, hits)`
|
|
306
|
+
* receives the sorted cast-result array from the post-step world state. The
|
|
307
|
+
* operation is deferred on the main thread rather than run concurrently. All
|
|
308
|
+
* queued casts for one world share one broadphase AABB refresh and all finish
|
|
309
|
+
* before their callbacks begin.
|
|
310
|
+
*
|
|
311
|
+
* @param world - world handle
|
|
312
|
+
* @param shape - convex query shape with optional target rotation
|
|
313
|
+
* @param translation - non-zero sweep displacement in world units
|
|
314
|
+
* @param callback - function called as `callback(self, hits)`
|
|
315
|
+
* @param filter - query filter
|
|
316
|
+
* @param max_results - maximum sorted hits, or zero for all
|
|
317
|
+
*/
|
|
318
|
+
function cast_shape_async(world: bullet3d.btDiscreteDynamicsWorld, shape: bullet3d.shape.definition, translation: Vector3, callback: (self: unknown, hits: bullet3d.world.cast_result[]) => void, filter?: bullet3d.world.query_filter, max_results?: number): void;
|
|
319
|
+
/**
|
|
320
|
+
* Equivalent to bullet3d.world.cast_shape with one result, but returns
|
|
321
|
+
* the hit table directly or `nil` on a miss.
|
|
322
|
+
*
|
|
323
|
+
* @param world - world handle
|
|
324
|
+
* @param shape - convex query shape with optional target rotation
|
|
325
|
+
* @param translation - non-zero sweep displacement in world units
|
|
326
|
+
* @param filter - query filter
|
|
327
|
+
* @returns closest cast result, or `nil` on a miss. **⚠️ `shape_index` is 1-based; passed to Defold unchanged.**
|
|
328
|
+
*/
|
|
329
|
+
function cast_shape_closest(world: bullet3d.btDiscreteDynamicsWorld, shape: bullet3d.shape.definition, translation: Vector3, filter?: bullet3d.world.query_filter): bullet3d.world.cast_result | undefined;
|
|
330
|
+
/**
|
|
331
|
+
* Runs Bullet's discrete pair contact algorithm without changing the simulation.
|
|
332
|
+
* Both borrowed handles must belong to `world` and must identify different
|
|
333
|
+
* objects. The output preserves the caller's A/B order even when Bullet's
|
|
334
|
+
* internal manifold order is reversed. Collision filters are not applied to an
|
|
335
|
+
* explicitly selected pair.
|
|
336
|
+
*
|
|
337
|
+
* @param world - world handle
|
|
338
|
+
* @param object_a - first collision object in the world
|
|
339
|
+
* @param object_b - different second collision object in the world
|
|
340
|
+
* @param max_results - maximum number of contact points, or zero for all
|
|
341
|
+
* @returns normalized contact results
|
|
342
|
+
*/
|
|
343
|
+
function contact_pair_test(world: bullet3d.btDiscreteDynamicsWorld, object_a: Opaque<"btCollisionObject" | "btRigidBody">, object_b: Opaque<"btCollisionObject" | "btRigidBody">, max_results?: number): bullet3d.world.contact_result[];
|
|
344
|
+
/**
|
|
345
|
+
* Runs Bullet's discrete contact test between `object` and matching objects in
|
|
346
|
+
* the same world. The supplied object is always `object_a` in returned contacts.
|
|
347
|
+
* The borrowed collision-object handle must belong to `world`. Bullet may return
|
|
348
|
+
* several contact points for one object pair and may include small positive
|
|
349
|
+
* contact-margin distances.
|
|
350
|
+
*
|
|
351
|
+
* @param world - world handle
|
|
352
|
+
* @param object - collision object belonging to the world
|
|
353
|
+
* @param filter - filter applied to candidate `object_b` values
|
|
354
|
+
* @param max_results - maximum number of contact points, or zero for all
|
|
355
|
+
* @returns normalized contact results
|
|
356
|
+
* @example
|
|
357
|
+
* ```ts
|
|
358
|
+
* // Inspect current contacts for this collision object:
|
|
359
|
+
* export default defineScript({
|
|
360
|
+
* update(self, dt) {
|
|
361
|
+
* const world = bullet3d.get_world();
|
|
362
|
+
* const object = bullet3d.get_collision_object("#collisionobject");
|
|
363
|
+
* if (world === undefined || object === undefined) return;
|
|
364
|
+
* const filter = { include_triggers: false };
|
|
365
|
+
* const contacts = bullet3d.world.contact_test(world, object, filter);
|
|
366
|
+
*
|
|
367
|
+
* for (const contact of contacts) {
|
|
368
|
+
* if (contact.distance < 0) {
|
|
369
|
+
* print("penetration", -contact.distance, "against", contact.object_b);
|
|
370
|
+
* }
|
|
371
|
+
* }
|
|
372
|
+
* },
|
|
373
|
+
* });
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
function contact_test(world: bullet3d.btDiscreteDynamicsWorld, object: Opaque<"btCollisionObject" | "btRigidBody">, filter?: bullet3d.world.query_filter, max_results?: number): bullet3d.world.contact_result[];
|
|
377
|
+
/**
|
|
378
|
+
* Get the number of collision objects in the world
|
|
379
|
+
*
|
|
380
|
+
* @param world - world handle
|
|
381
|
+
* @returns number of collision objects
|
|
382
|
+
*/
|
|
383
|
+
function get_collision_object_count(world: bullet3d.btDiscreteDynamicsWorld): number;
|
|
384
|
+
/**
|
|
385
|
+
* Returns the Defold-owned collision objects currently registered in the world.
|
|
386
|
+
* Internal or unmanaged Bullet objects without Defold ownership metadata are
|
|
387
|
+
* not exposed.
|
|
388
|
+
*
|
|
389
|
+
* @param world - world handle
|
|
390
|
+
* @param max_results - maximum number of results, or zero for all
|
|
391
|
+
* @returns array of collision-object handles
|
|
392
|
+
*/
|
|
393
|
+
function get_collision_objects(world: bullet3d.btDiscreteDynamicsWorld, max_results?: number): Opaque<"btCollisionObject" | "btRigidBody">[];
|
|
394
|
+
/**
|
|
395
|
+
* Get world gravity
|
|
396
|
+
*
|
|
397
|
+
* @param world - world handle
|
|
398
|
+
* @returns gravity in Defold units per second squared
|
|
399
|
+
*/
|
|
400
|
+
function get_gravity(world: bullet3d.btDiscreteDynamicsWorld): Vector3;
|
|
401
|
+
/**
|
|
402
|
+
* Test whether a world handle is valid
|
|
403
|
+
*
|
|
404
|
+
* @param world - world handle
|
|
405
|
+
* @returns `true` if the native world still exists
|
|
406
|
+
*/
|
|
407
|
+
function is_valid(world: bullet3d.btDiscreteDynamicsWorld): boolean;
|
|
408
|
+
/**
|
|
409
|
+
* Finds collision objects whose Bullet broadphase bounds overlap the supplied
|
|
410
|
+
* world-space AABB. This is intentionally a broadphase query and can include
|
|
411
|
+
* objects whose actual collision geometry does not intersect the box. Use
|
|
412
|
+
* bullet3d.world.overlap_point or
|
|
413
|
+
* bullet3d.world.overlap_shape for exact narrow-phase overlap tests.
|
|
414
|
+
*
|
|
415
|
+
* @param world - world handle
|
|
416
|
+
* @param aabb - world-space bounds
|
|
417
|
+
* @param filter - query filter
|
|
418
|
+
* @param max_results - maximum number of results, or zero for all
|
|
419
|
+
* @returns array of overlapping collision-object handles
|
|
420
|
+
*/
|
|
421
|
+
function overlap_aabb(world: bullet3d.btDiscreteDynamicsWorld, aabb: bullet3d.world.aabb, filter?: bullet3d.world.query_filter, max_results?: number): Opaque<"btCollisionObject" | "btRigidBody">[];
|
|
422
|
+
/**
|
|
423
|
+
* Performs an exact narrow-phase test using a temporary zero-radius Bullet
|
|
424
|
+
* sphere at the world-space point. A result is returned only for a contact with
|
|
425
|
+
* signed distance less than or equal to zero, so broadphase-only false positives
|
|
426
|
+
* are removed. Results on an exact surface follow Bullet's contact tolerance.
|
|
427
|
+
*
|
|
428
|
+
* @param world - world handle
|
|
429
|
+
* @param point - point in world space
|
|
430
|
+
* @param filter - query filter
|
|
431
|
+
* @param max_results - maximum number of results, or zero for all
|
|
432
|
+
* @returns array of overlapping collision-object handles
|
|
433
|
+
*/
|
|
434
|
+
function overlap_point(world: bullet3d.btDiscreteDynamicsWorld, point: Vector3, filter?: bullet3d.world.query_filter, max_results?: number): Opaque<"btCollisionObject" | "btRigidBody">[];
|
|
435
|
+
/**
|
|
436
|
+
* Performs an exact Bullet contact test for a temporary sphere, box, Y-axis
|
|
437
|
+
* capsule, or convex hull. Multiple native contact points for the same target
|
|
438
|
+
* object are deduplicated in the returned overlap array.
|
|
439
|
+
*
|
|
440
|
+
* @param world - world handle
|
|
441
|
+
* @param shape - convex query shape
|
|
442
|
+
* @param filter - query filter
|
|
443
|
+
* @param max_results - maximum number of results, or zero for all
|
|
444
|
+
* @returns array of overlapping collision-object handles
|
|
445
|
+
* @example
|
|
446
|
+
* ```ts
|
|
447
|
+
* // Find non-trigger objects overlapping a two-unit sphere around this game object:
|
|
448
|
+
* export default defineScript({
|
|
449
|
+
* init() {
|
|
450
|
+
* const world = bullet3d.get_world();
|
|
451
|
+
* if (world === undefined) return;
|
|
452
|
+
* const shape = {
|
|
453
|
+
* type: bullet3d.shape.SHAPE_TYPE_SPHERE,
|
|
454
|
+
* diameter: 2,
|
|
455
|
+
* position: go.get_world_position(),
|
|
456
|
+
* };
|
|
457
|
+
* const filter = { include_triggers: false };
|
|
458
|
+
* const overlaps = bullet3d.world.overlap_shape(world, shape, filter);
|
|
459
|
+
*
|
|
460
|
+
* for (const object of overlaps) {
|
|
461
|
+
* print("overlap", object);
|
|
462
|
+
* }
|
|
463
|
+
* },
|
|
464
|
+
* });
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
function overlap_shape(world: bullet3d.btDiscreteDynamicsWorld, shape: bullet3d.shape.definition, filter?: bullet3d.world.query_filter, max_results?: number): Opaque<"btCollisionObject" | "btRigidBody">[];
|
|
468
|
+
/**
|
|
469
|
+
* Bullet propagates the new value to active dynamic bodies unless they have
|
|
470
|
+
* `bullet3d.rigid_body.BT_DISABLE_WORLD_GRAVITY` set. Such bodies retain their
|
|
471
|
+
* custom body gravity.
|
|
472
|
+
*
|
|
473
|
+
* @param world - world handle
|
|
474
|
+
* @param gravity - finite gravity in Defold units per second squared
|
|
475
|
+
* @example
|
|
476
|
+
* ```ts
|
|
477
|
+
* // Set gravity for the current collection's physics world:
|
|
478
|
+
* export default defineScript({
|
|
479
|
+
* init() {
|
|
480
|
+
* const world = bullet3d.get_world();
|
|
481
|
+
* if (world !== undefined) {
|
|
482
|
+
* bullet3d.world.set_gravity(world, vmath.vector3(0, -9.81, 0));
|
|
483
|
+
* }
|
|
484
|
+
* },
|
|
485
|
+
* });
|
|
486
|
+
* ```
|
|
487
|
+
*/
|
|
488
|
+
function set_gravity(world: bullet3d.btDiscreteDynamicsWorld, gravity: Vector3): void;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export {};
|