@defold-typescript/types 0.49.0 → 0.50.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 +696 -624
- package/api-signatures.json +6799 -160
- package/api-targets.json +393 -2
- package/examples/translations.json +12 -0
- package/generated/b2d.d.ts +15 -0
- package/generated/bullet3d.d.ts +16 -0
- package/generated/font.d.ts +7 -3
- package/generated/graphics.d.ts +7 -0
- package/generated/gui.d.ts +5 -4
- package/generated/label.d.ts +3 -3
- package/generated/render.d.ts +16 -1
- package/generated/versions/defold-1.13.2/b2d.d.ts +709 -0
- package/generated/versions/defold-1.13.2/b2d_body.d.ts +593 -0
- package/generated/versions/defold-1.13.2/b2d_chain.d.ts +105 -0
- package/generated/versions/defold-1.13.2/b2d_fixture.d.ts +175 -0
- package/generated/versions/defold-1.13.2/b2d_joint.d.ts +1301 -0
- package/generated/versions/defold-1.13.2/b2d_shape.d.ts +423 -0
- package/generated/versions/defold-1.13.2/b2d_world.d.ts +308 -0
- package/generated/versions/defold-1.13.2/buffer.d.ts +192 -0
- package/generated/versions/defold-1.13.2/bullet3d.d.ts +91 -0
- package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +433 -0
- package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +818 -0
- package/generated/versions/defold-1.13.2/bullet3d_rigid_body.d.ts +429 -0
- package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +123 -0
- package/generated/versions/defold-1.13.2/bullet3d_world.d.ts +492 -0
- package/generated/versions/defold-1.13.2/camera.d.ts +300 -0
- package/generated/versions/defold-1.13.2/collectionfactory.d.ts +148 -0
- package/generated/versions/defold-1.13.2/collectionproxy.d.ts +109 -0
- package/generated/versions/defold-1.13.2/compute.d.ts +107 -0
- package/generated/versions/defold-1.13.2/crash.d.ts +157 -0
- package/generated/versions/defold-1.13.2/editor-vm/http.d.ts +139 -0
- package/generated/versions/defold-1.13.2/editor-vm/image.d.ts +48 -0
- package/generated/versions/defold-1.13.2/editor-vm/json.d.ts +21 -0
- package/generated/versions/defold-1.13.2/editor-vm/localization.d.ts +42 -0
- package/generated/versions/defold-1.13.2/editor-vm/tilemap_tiles.d.ts +126 -0
- package/generated/versions/defold-1.13.2/editor-vm/zip.d.ts +38 -0
- package/generated/versions/defold-1.13.2/editor-vm/zlib.d.ts +24 -0
- package/generated/versions/defold-1.13.2/editor.d.ts +2177 -0
- package/generated/versions/defold-1.13.2/factory.d.ts +121 -0
- package/generated/versions/defold-1.13.2/font.d.ts +123 -0
- package/generated/versions/defold-1.13.2/go.d.ts +1166 -0
- package/generated/versions/defold-1.13.2/graphics.d.ts +613 -0
- package/generated/versions/defold-1.13.2/gui.d.ts +2212 -0
- package/generated/versions/defold-1.13.2/html5.d.ts +55 -0
- package/generated/versions/defold-1.13.2/http.d.ts +83 -0
- package/generated/versions/defold-1.13.2/image.d.ts +181 -0
- package/generated/versions/defold-1.13.2/index.d.ts +63 -0
- package/generated/versions/defold-1.13.2/json.d.ts +94 -0
- package/generated/versions/defold-1.13.2/kinds/editor-script.d.ts +14 -0
- package/generated/versions/defold-1.13.2/label.d.ts +164 -0
- package/generated/versions/defold-1.13.2/liveupdate.d.ts +143 -0
- package/generated/versions/defold-1.13.2/material.d.ts +490 -0
- package/generated/versions/defold-1.13.2/model.d.ts +287 -0
- package/generated/versions/defold-1.13.2/msg.d.ts +10 -0
- package/generated/versions/defold-1.13.2/particlefx.d.ts +155 -0
- package/generated/versions/defold-1.13.2/physics.d.ts +789 -0
- package/generated/versions/defold-1.13.2/profiler.d.ts +228 -0
- package/generated/versions/defold-1.13.2/render.d.ts +1153 -0
- package/generated/versions/defold-1.13.2/resource.d.ts +1628 -0
- package/generated/versions/defold-1.13.2/socket.d.ts +797 -0
- package/generated/versions/defold-1.13.2/sound.d.ts +323 -0
- package/generated/versions/defold-1.13.2/sprite.d.ts +179 -0
- package/generated/versions/defold-1.13.2/sys.d.ts +754 -0
- package/generated/versions/defold-1.13.2/tilemap.d.ts +206 -0
- package/generated/versions/defold-1.13.2/timer.d.ts +136 -0
- package/generated/versions/defold-1.13.2/types.d.ts +61 -0
- package/generated/versions/defold-1.13.2/vmath.d.ts +775 -0
- package/generated/versions/defold-1.13.2/window.d.ts +196 -0
- package/generated/versions/defold-1.13.2/zlib.d.ts +41 -0
- package/identity-vocabulary.json +1 -0
- package/package.json +2 -2
- package/scripts/import-defold-release.ts +3 -31
- package/scripts/materialize-version.ts +13 -7
- package/scripts/regen.ts +63 -29
- package/scripts/sync-api-docs.ts +31 -2
- package/src/emit-dts.ts +25 -3
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import type { Opaque, Vector3 } from "../../../src/core-types";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Constants for functional shape tables used with `b2d.body.create_fixture`
|
|
7
|
+
* and returned from `b2d.fixture.get_shape`.
|
|
8
|
+
*/
|
|
9
|
+
namespace b2d.shape {
|
|
10
|
+
type b2Shape = Opaque<"b2Shape">;
|
|
11
|
+
type definition = { type: b2d.shape.SHAPE_TYPE; radius: number; center?: Vector3 } | { type: b2d.shape.SHAPE_TYPE; radius: number; center1: Vector3; center2: Vector3 } | { type: b2d.shape.SHAPE_TYPE; v1: Vector3; v2: Vector3; v0?: Vector3; v3?: Vector3 } | { type: b2d.shape.SHAPE_TYPE; hx: number; hy: number; center?: Vector3; angle?: number } | { type: b2d.shape.SHAPE_TYPE; vertices: Vector3[]; loop?: boolean; prev_vertex?: Vector3; next_vertex?: Vector3 };
|
|
12
|
+
type SHAPE_TYPE = typeof b2d.shape.SHAPE_TYPE_BOX | typeof b2d.shape.SHAPE_TYPE_CAPSULE | typeof b2d.shape.SHAPE_TYPE_CHAIN | typeof b2d.shape.SHAPE_TYPE_CIRCLE | typeof b2d.shape.SHAPE_TYPE_EDGE | typeof b2d.shape.SHAPE_TYPE_GRID | typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_SEGMENT;
|
|
13
|
+
/**
|
|
14
|
+
* Box shape type alias. Uses the polygon enum value, but indicates the `hx`/`hy` box convenience format.
|
|
15
|
+
*/
|
|
16
|
+
const SHAPE_TYPE_BOX: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_BOX" };
|
|
17
|
+
/**
|
|
18
|
+
* Capsule shape type.
|
|
19
|
+
*/
|
|
20
|
+
const SHAPE_TYPE_CAPSULE: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_CAPSULE" };
|
|
21
|
+
/**
|
|
22
|
+
* Chain shape type.
|
|
23
|
+
*/
|
|
24
|
+
const SHAPE_TYPE_CHAIN: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_CHAIN" };
|
|
25
|
+
/**
|
|
26
|
+
* Circle shape type.
|
|
27
|
+
*/
|
|
28
|
+
const SHAPE_TYPE_CIRCLE: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_CIRCLE" };
|
|
29
|
+
/**
|
|
30
|
+
* Edge shape type alias. Compatibility alias for `b2d.shape.SHAPE_TYPE_SEGMENT`.
|
|
31
|
+
*/
|
|
32
|
+
const SHAPE_TYPE_EDGE: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_EDGE" };
|
|
33
|
+
/**
|
|
34
|
+
* Grid shape type.
|
|
35
|
+
*/
|
|
36
|
+
const SHAPE_TYPE_GRID: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_GRID" };
|
|
37
|
+
/**
|
|
38
|
+
* Polygon shape type.
|
|
39
|
+
*/
|
|
40
|
+
const SHAPE_TYPE_POLYGON: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_POLYGON" };
|
|
41
|
+
/**
|
|
42
|
+
* Segment shape type.
|
|
43
|
+
*/
|
|
44
|
+
const SHAPE_TYPE_SEGMENT: number & { readonly __brand: "b2d.shape.SHAPE_TYPE_SEGMENT" };
|
|
45
|
+
/**
|
|
46
|
+
* Check if contact events are enabled for a shape.
|
|
47
|
+
*
|
|
48
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
49
|
+
* @returns true if contact events are enabled
|
|
50
|
+
*/
|
|
51
|
+
function are_contact_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Check if contact events are enabled for a shape.
|
|
54
|
+
*
|
|
55
|
+
* @param body - The body that owns the shape.
|
|
56
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
57
|
+
* @returns true if contact events are enabled
|
|
58
|
+
*/
|
|
59
|
+
function are_contact_events_enabled(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Check if hit events are enabled for a shape.
|
|
62
|
+
*
|
|
63
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
64
|
+
* @returns true if hit events are enabled
|
|
65
|
+
*/
|
|
66
|
+
function are_hit_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Check if hit events are enabled for a shape.
|
|
69
|
+
*
|
|
70
|
+
* @param body - The body that owns the shape.
|
|
71
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
72
|
+
* @returns true if hit events are enabled
|
|
73
|
+
*/
|
|
74
|
+
function are_hit_events_enabled(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Check if pre-solve events are enabled for a shape.
|
|
77
|
+
*
|
|
78
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
79
|
+
* @returns true if pre-solve events are enabled
|
|
80
|
+
*/
|
|
81
|
+
function are_pre_solve_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Check if pre-solve events are enabled for a shape.
|
|
84
|
+
*
|
|
85
|
+
* @param body - The body that owns the shape.
|
|
86
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
87
|
+
* @returns true if pre-solve events are enabled
|
|
88
|
+
*/
|
|
89
|
+
function are_pre_solve_events_enabled(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Check if sensor events are enabled for a shape.
|
|
92
|
+
*
|
|
93
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
94
|
+
* @returns true if sensor events are enabled
|
|
95
|
+
*/
|
|
96
|
+
function are_sensor_events_enabled(shape_id: Opaque<"b2Shape">): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Check if sensor events are enabled for a shape.
|
|
99
|
+
*
|
|
100
|
+
* @param body - The body that owns the shape.
|
|
101
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
102
|
+
* @returns true if sensor events are enabled
|
|
103
|
+
*/
|
|
104
|
+
function are_sensor_events_enabled(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Enable or disable contact events for a shape.
|
|
107
|
+
*
|
|
108
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
109
|
+
* @param enable - true to enable contact events
|
|
110
|
+
*/
|
|
111
|
+
function enable_contact_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
|
|
112
|
+
/**
|
|
113
|
+
* Enable or disable contact events for a shape.
|
|
114
|
+
*
|
|
115
|
+
* @param body - The body that owns the shape.
|
|
116
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
117
|
+
* @param enable - true to enable contact events
|
|
118
|
+
*/
|
|
119
|
+
function enable_contact_events(body: Opaque<"b2Body">, shape_index: number, enable: boolean): void;
|
|
120
|
+
/**
|
|
121
|
+
* Enable or disable hit events for a shape.
|
|
122
|
+
*
|
|
123
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
124
|
+
* @param enable - true to enable hit events
|
|
125
|
+
*/
|
|
126
|
+
function enable_hit_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
|
|
127
|
+
/**
|
|
128
|
+
* Enable or disable hit events for a shape.
|
|
129
|
+
*
|
|
130
|
+
* @param body - The body that owns the shape.
|
|
131
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
132
|
+
* @param enable - true to enable hit events
|
|
133
|
+
*/
|
|
134
|
+
function enable_hit_events(body: Opaque<"b2Body">, shape_index: number, enable: boolean): void;
|
|
135
|
+
/**
|
|
136
|
+
* Enable or disable pre-solve events for a shape.
|
|
137
|
+
*
|
|
138
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
139
|
+
* @param enable - true to enable pre-solve events
|
|
140
|
+
*/
|
|
141
|
+
function enable_pre_solve_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
|
|
142
|
+
/**
|
|
143
|
+
* Enable or disable pre-solve events for a shape.
|
|
144
|
+
*
|
|
145
|
+
* @param body - The body that owns the shape.
|
|
146
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
147
|
+
* @param enable - true to enable pre-solve events
|
|
148
|
+
*/
|
|
149
|
+
function enable_pre_solve_events(body: Opaque<"b2Body">, shape_index: number, enable: boolean): void;
|
|
150
|
+
/**
|
|
151
|
+
* Enable or disable sensor events for a shape.
|
|
152
|
+
*
|
|
153
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
154
|
+
* @param enable - true to enable sensor events
|
|
155
|
+
*/
|
|
156
|
+
function enable_sensor_events(shape_id: Opaque<"b2Shape">, enable: boolean): void;
|
|
157
|
+
/**
|
|
158
|
+
* Enable or disable sensor events for a shape.
|
|
159
|
+
*
|
|
160
|
+
* @param body - The body that owns the shape.
|
|
161
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
162
|
+
* @param enable - true to enable sensor events
|
|
163
|
+
*/
|
|
164
|
+
function enable_sensor_events(body: Opaque<"b2Body">, shape_index: number, enable: boolean): void;
|
|
165
|
+
/**
|
|
166
|
+
* Get the body owning a shape.
|
|
167
|
+
*
|
|
168
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
169
|
+
* @returns owning body
|
|
170
|
+
*/
|
|
171
|
+
function get_body(shape_id: Opaque<"b2Shape">): Opaque<"b2Body">;
|
|
172
|
+
/**
|
|
173
|
+
* Get the body owning a shape.
|
|
174
|
+
*
|
|
175
|
+
* @param body - The body that owns the shape.
|
|
176
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
177
|
+
* @returns owning body
|
|
178
|
+
*/
|
|
179
|
+
function get_body(body: Opaque<"b2Body">, shape_index: number): Opaque<"b2Body">;
|
|
180
|
+
/**
|
|
181
|
+
* Get the closest point on a shape.
|
|
182
|
+
*
|
|
183
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
184
|
+
* @param target - world target point
|
|
185
|
+
* @returns closest world point on the shape
|
|
186
|
+
*/
|
|
187
|
+
function get_closest_point(shape_id: Opaque<"b2Shape">, target: Vector3): Vector3;
|
|
188
|
+
/**
|
|
189
|
+
* Get the closest point on a shape.
|
|
190
|
+
*
|
|
191
|
+
* @param body - The body that owns the shape.
|
|
192
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
193
|
+
* @param target - world target point
|
|
194
|
+
* @returns closest world point on the shape
|
|
195
|
+
*/
|
|
196
|
+
function get_closest_point(body: Opaque<"b2Body">, shape_index: number, target: Vector3): Vector3;
|
|
197
|
+
/**
|
|
198
|
+
* Get shape contact capacity.
|
|
199
|
+
*
|
|
200
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
201
|
+
* @returns maximum contact data count
|
|
202
|
+
*/
|
|
203
|
+
function get_contact_capacity(shape_id: Opaque<"b2Shape">): number;
|
|
204
|
+
/**
|
|
205
|
+
* Get shape contact capacity.
|
|
206
|
+
*
|
|
207
|
+
* @param body - The body that owns the shape.
|
|
208
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
209
|
+
* @returns maximum contact data count
|
|
210
|
+
*/
|
|
211
|
+
function get_contact_capacity(body: Opaque<"b2Body">, shape_index: number): number;
|
|
212
|
+
/**
|
|
213
|
+
* Get touching contact data for a shape.
|
|
214
|
+
*
|
|
215
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
216
|
+
* @returns touching contacts
|
|
217
|
+
*/
|
|
218
|
+
function get_contact_data(shape_id: Opaque<"b2Shape">): b2d.contact_data[];
|
|
219
|
+
/**
|
|
220
|
+
* Get touching contact data for a shape.
|
|
221
|
+
*
|
|
222
|
+
* @param body - The body that owns the shape.
|
|
223
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
224
|
+
* @returns touching contacts
|
|
225
|
+
*/
|
|
226
|
+
function get_contact_data(body: Opaque<"b2Body">, shape_index: number): b2d.contact_data[];
|
|
227
|
+
/**
|
|
228
|
+
* Get mass data for a shape.
|
|
229
|
+
*
|
|
230
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
231
|
+
* @returns shape mass data
|
|
232
|
+
*/
|
|
233
|
+
function get_mass_data(shape_id: Opaque<"b2Shape">): b2d.mass_data;
|
|
234
|
+
/**
|
|
235
|
+
* Get mass data for a shape.
|
|
236
|
+
*
|
|
237
|
+
* @param body - The body that owns the shape.
|
|
238
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
239
|
+
* @returns shape mass data
|
|
240
|
+
*/
|
|
241
|
+
function get_mass_data(body: Opaque<"b2Body">, shape_index: number): b2d.mass_data;
|
|
242
|
+
/**
|
|
243
|
+
* Get shape material id.
|
|
244
|
+
*
|
|
245
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
246
|
+
* @returns shape material id
|
|
247
|
+
*/
|
|
248
|
+
function get_material(shape_id: Opaque<"b2Shape">): number;
|
|
249
|
+
/**
|
|
250
|
+
* Get shape material id.
|
|
251
|
+
*
|
|
252
|
+
* @param body - The body that owns the shape.
|
|
253
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
254
|
+
* @returns shape material id
|
|
255
|
+
*/
|
|
256
|
+
function get_material(body: Opaque<"b2Body">, shape_index: number): number;
|
|
257
|
+
/**
|
|
258
|
+
* Get sensor overlap capacity.
|
|
259
|
+
*
|
|
260
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
261
|
+
* @returns maximum sensor overlap count
|
|
262
|
+
*/
|
|
263
|
+
function get_sensor_capacity(shape_id: Opaque<"b2Shape">): number;
|
|
264
|
+
/**
|
|
265
|
+
* Get sensor overlap capacity.
|
|
266
|
+
*
|
|
267
|
+
* @param body - The body that owns the shape.
|
|
268
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
269
|
+
* @returns maximum sensor overlap count
|
|
270
|
+
*/
|
|
271
|
+
function get_sensor_capacity(body: Opaque<"b2Body">, shape_index: number): number;
|
|
272
|
+
/**
|
|
273
|
+
* Get sensor overlaps.
|
|
274
|
+
*
|
|
275
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
276
|
+
* @returns overlapping shapes
|
|
277
|
+
*/
|
|
278
|
+
function get_sensor_overlaps(shape_id: Opaque<"b2Shape">): b2d.shape_info[];
|
|
279
|
+
/**
|
|
280
|
+
* Get sensor overlaps.
|
|
281
|
+
*
|
|
282
|
+
* @param body - The body that owns the shape.
|
|
283
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
284
|
+
* @returns overlapping shapes
|
|
285
|
+
*/
|
|
286
|
+
function get_sensor_overlaps(body: Opaque<"b2Body">, shape_index: number): b2d.shape_info[];
|
|
287
|
+
/**
|
|
288
|
+
* Get a shape's geometry.
|
|
289
|
+
*
|
|
290
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
291
|
+
* @returns shape table with numeric `type` from `b2d.shape.SHAPE_TYPE_*`
|
|
292
|
+
*/
|
|
293
|
+
function get_shape(shape_id: Opaque<"b2Shape">): b2d.shape.definition;
|
|
294
|
+
/**
|
|
295
|
+
* Get a shape's geometry.
|
|
296
|
+
*
|
|
297
|
+
* @param body - The body that owns the shape.
|
|
298
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
299
|
+
* @returns shape table with numeric `type` from `b2d.shape.SHAPE_TYPE_*`
|
|
300
|
+
*/
|
|
301
|
+
function get_shape(body: Opaque<"b2Body">, shape_index: number): b2d.shape.definition;
|
|
302
|
+
/**
|
|
303
|
+
* Get the world owning a shape.
|
|
304
|
+
*
|
|
305
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
306
|
+
* @returns owning world
|
|
307
|
+
*/
|
|
308
|
+
function get_world(shape_id: Opaque<"b2Shape">): Opaque<"b2World">;
|
|
309
|
+
/**
|
|
310
|
+
* Get the world owning a shape.
|
|
311
|
+
*
|
|
312
|
+
* @param body - The body that owns the shape.
|
|
313
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
314
|
+
* @returns owning world
|
|
315
|
+
*/
|
|
316
|
+
function get_world(body: Opaque<"b2Body">, shape_index: number): Opaque<"b2World">;
|
|
317
|
+
/**
|
|
318
|
+
* Validate a shape handle.
|
|
319
|
+
*
|
|
320
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
321
|
+
* @returns true if the shape handle still refers to a live Box2D shape
|
|
322
|
+
*/
|
|
323
|
+
function is_valid(shape_id: Opaque<"b2Shape">): boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Validate a shape handle.
|
|
326
|
+
*
|
|
327
|
+
* @param body - The body that owns the shape.
|
|
328
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
329
|
+
* @returns true if the shape handle still refers to a live Box2D shape
|
|
330
|
+
*/
|
|
331
|
+
function is_valid(body: Opaque<"b2Body">, shape_index: number): boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Ray cast a shape directly.
|
|
334
|
+
*
|
|
335
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
336
|
+
* @param origin - world ray origin
|
|
337
|
+
* @param translation - world ray translation
|
|
338
|
+
* @param max_fraction - optional maximum translation fraction, defaults to 1
|
|
339
|
+
* @returns cast result, or `nil`
|
|
340
|
+
*/
|
|
341
|
+
function ray_cast(shape_id: Opaque<"b2Shape">, origin: Vector3, translation: Vector3, max_fraction?: number): b2d.shape_cast_output | undefined;
|
|
342
|
+
/**
|
|
343
|
+
* Ray cast a shape directly.
|
|
344
|
+
*
|
|
345
|
+
* @param body - The body that owns the shape.
|
|
346
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
347
|
+
* @param origin - world ray origin
|
|
348
|
+
* @param translation - world ray translation
|
|
349
|
+
* @param max_fraction - optional maximum translation fraction, defaults to 1
|
|
350
|
+
* @returns cast result, or `nil`
|
|
351
|
+
*/
|
|
352
|
+
function ray_cast(body: Opaque<"b2Body">, shape_index: number, origin: Vector3, translation: Vector3, max_fraction?: number): b2d.shape_cast_output | undefined;
|
|
353
|
+
/**
|
|
354
|
+
* Set shape material id.
|
|
355
|
+
*
|
|
356
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
357
|
+
* @param material - shape material id
|
|
358
|
+
*/
|
|
359
|
+
function set_material(shape_id: Opaque<"b2Shape">, material: number): void;
|
|
360
|
+
/**
|
|
361
|
+
* Set shape material id.
|
|
362
|
+
*
|
|
363
|
+
* @param body - The body that owns the shape.
|
|
364
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
365
|
+
* @param material - shape material id
|
|
366
|
+
*/
|
|
367
|
+
function set_material(body: Opaque<"b2Body">, shape_index: number, material: number): void;
|
|
368
|
+
/**
|
|
369
|
+
* This updates the shape geometry using the same table format as
|
|
370
|
+
* `b2d.body.create_shape` and `b2d.shape.get_shape`. The body mass is not
|
|
371
|
+
* updated unless `update_mass` is true.
|
|
372
|
+
*
|
|
373
|
+
* @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
|
|
374
|
+
* @param definition - shape table with numeric `type` from `b2d.shape.SHAPE_TYPE_*`
|
|
375
|
+
* @param update_mass - true to reset body mass from shapes
|
|
376
|
+
* @example
|
|
377
|
+
* ```ts
|
|
378
|
+
* const body = b2d.get_body("#collisionobject");
|
|
379
|
+
* if (body !== undefined) {
|
|
380
|
+
* // Move a circle shape relative to the body origin.
|
|
381
|
+
* const circle = b2d.shape.get_shape(body, 1);
|
|
382
|
+
* const radius = "radius" in circle ? circle.radius : undefined;
|
|
383
|
+
* b2d.shape.set_shape(body, 1, { type: b2d.shape.SHAPE_TYPE_CIRCLE, radius: radius ?? 16, center: vmath.vector3(24, 0, 0) }, true);
|
|
384
|
+
*
|
|
385
|
+
* // Replace a segment shape's local endpoints.
|
|
386
|
+
* b2d.shape.set_shape(body, 2, {
|
|
387
|
+
* type: b2d.shape.SHAPE_TYPE_SEGMENT,
|
|
388
|
+
* v1: vmath.vector3(-32, 0, 0),
|
|
389
|
+
* v2: vmath.vector3(32, 0, 0),
|
|
390
|
+
* });
|
|
391
|
+
*
|
|
392
|
+
* // Update a box shape using the polygon box convenience format.
|
|
393
|
+
* b2d.shape.set_shape(
|
|
394
|
+
* body,
|
|
395
|
+
* 3,
|
|
396
|
+
* {
|
|
397
|
+
* type: b2d.shape.SHAPE_TYPE_BOX,
|
|
398
|
+
* hx: 16,
|
|
399
|
+
* hy: 8,
|
|
400
|
+
* center: vmath.vector3(0, 20, 0),
|
|
401
|
+
* angle: math.rad(30),
|
|
402
|
+
* },
|
|
403
|
+
* true,
|
|
404
|
+
* );
|
|
405
|
+
* }
|
|
406
|
+
* ```
|
|
407
|
+
*/
|
|
408
|
+
function set_shape(shape_id: Opaque<"b2Shape">, definition: { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; hx: number; hy: number; center?: Vector3; angle?: number } | { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; vertices: Vector3[] } | { type: typeof b2d.shape.SHAPE_TYPE_CIRCLE; radius: number; center?: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_CAPSULE; radius: number; center1: Vector3; center2: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_EDGE | typeof b2d.shape.SHAPE_TYPE_SEGMENT; v1: Vector3; v2: Vector3 }, update_mass?: boolean): void;
|
|
409
|
+
/**
|
|
410
|
+
* This updates the shape geometry using the same table format as
|
|
411
|
+
* `b2d.body.create_shape` and `b2d.shape.get_shape`. The body mass is not
|
|
412
|
+
* updated unless `update_mass` is true.
|
|
413
|
+
*
|
|
414
|
+
* @param body - The body that owns the shape.
|
|
415
|
+
* @param shape_index - The shape's position on that body, in the order `b2d.body.get_shapes` lists them. **⚠️ 1-based; passed to Defold unchanged.**
|
|
416
|
+
* @param definition - shape table with numeric `type` from `b2d.shape.SHAPE_TYPE_*`
|
|
417
|
+
* @param update_mass - true to reset body mass from shapes
|
|
418
|
+
*/
|
|
419
|
+
function set_shape(body: Opaque<"b2Body">, shape_index: number, definition: { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; hx: number; hy: number; center?: Vector3; angle?: number } | { type: typeof b2d.shape.SHAPE_TYPE_POLYGON | typeof b2d.shape.SHAPE_TYPE_BOX; vertices: Vector3[] } | { type: typeof b2d.shape.SHAPE_TYPE_CIRCLE; radius: number; center?: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_CAPSULE; radius: number; center1: Vector3; center2: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_EDGE | typeof b2d.shape.SHAPE_TYPE_SEGMENT; v1: Vector3; v2: Vector3 }, update_mass?: boolean): void;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export {};
|