@defold-typescript/types 0.49.0 → 0.50.1

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.
Files changed (76) hide show
  1. package/api-availability.json +696 -624
  2. package/api-signatures.json +6799 -160
  3. package/api-targets.json +393 -2
  4. package/examples/translations.json +12 -0
  5. package/generated/b2d.d.ts +15 -0
  6. package/generated/bullet3d.d.ts +16 -0
  7. package/generated/font.d.ts +7 -3
  8. package/generated/graphics.d.ts +7 -0
  9. package/generated/gui.d.ts +5 -4
  10. package/generated/label.d.ts +3 -3
  11. package/generated/render.d.ts +16 -1
  12. package/generated/versions/defold-1.13.2/b2d.d.ts +709 -0
  13. package/generated/versions/defold-1.13.2/b2d_body.d.ts +593 -0
  14. package/generated/versions/defold-1.13.2/b2d_chain.d.ts +105 -0
  15. package/generated/versions/defold-1.13.2/b2d_fixture.d.ts +175 -0
  16. package/generated/versions/defold-1.13.2/b2d_joint.d.ts +1301 -0
  17. package/generated/versions/defold-1.13.2/b2d_shape.d.ts +423 -0
  18. package/generated/versions/defold-1.13.2/b2d_world.d.ts +308 -0
  19. package/generated/versions/defold-1.13.2/buffer.d.ts +192 -0
  20. package/generated/versions/defold-1.13.2/bullet3d.d.ts +91 -0
  21. package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +433 -0
  22. package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +818 -0
  23. package/generated/versions/defold-1.13.2/bullet3d_rigid_body.d.ts +429 -0
  24. package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +123 -0
  25. package/generated/versions/defold-1.13.2/bullet3d_world.d.ts +492 -0
  26. package/generated/versions/defold-1.13.2/camera.d.ts +300 -0
  27. package/generated/versions/defold-1.13.2/collectionfactory.d.ts +148 -0
  28. package/generated/versions/defold-1.13.2/collectionproxy.d.ts +109 -0
  29. package/generated/versions/defold-1.13.2/compute.d.ts +107 -0
  30. package/generated/versions/defold-1.13.2/crash.d.ts +157 -0
  31. package/generated/versions/defold-1.13.2/editor-vm/http.d.ts +139 -0
  32. package/generated/versions/defold-1.13.2/editor-vm/image.d.ts +48 -0
  33. package/generated/versions/defold-1.13.2/editor-vm/json.d.ts +21 -0
  34. package/generated/versions/defold-1.13.2/editor-vm/localization.d.ts +42 -0
  35. package/generated/versions/defold-1.13.2/editor-vm/tilemap_tiles.d.ts +126 -0
  36. package/generated/versions/defold-1.13.2/editor-vm/zip.d.ts +38 -0
  37. package/generated/versions/defold-1.13.2/editor-vm/zlib.d.ts +24 -0
  38. package/generated/versions/defold-1.13.2/editor.d.ts +2177 -0
  39. package/generated/versions/defold-1.13.2/factory.d.ts +121 -0
  40. package/generated/versions/defold-1.13.2/font.d.ts +123 -0
  41. package/generated/versions/defold-1.13.2/go.d.ts +1166 -0
  42. package/generated/versions/defold-1.13.2/graphics.d.ts +613 -0
  43. package/generated/versions/defold-1.13.2/gui.d.ts +2212 -0
  44. package/generated/versions/defold-1.13.2/html5.d.ts +55 -0
  45. package/generated/versions/defold-1.13.2/http.d.ts +83 -0
  46. package/generated/versions/defold-1.13.2/image.d.ts +181 -0
  47. package/generated/versions/defold-1.13.2/index.d.ts +63 -0
  48. package/generated/versions/defold-1.13.2/json.d.ts +94 -0
  49. package/generated/versions/defold-1.13.2/kinds/editor-script.d.ts +14 -0
  50. package/generated/versions/defold-1.13.2/label.d.ts +164 -0
  51. package/generated/versions/defold-1.13.2/liveupdate.d.ts +143 -0
  52. package/generated/versions/defold-1.13.2/material.d.ts +490 -0
  53. package/generated/versions/defold-1.13.2/model.d.ts +287 -0
  54. package/generated/versions/defold-1.13.2/msg.d.ts +10 -0
  55. package/generated/versions/defold-1.13.2/particlefx.d.ts +155 -0
  56. package/generated/versions/defold-1.13.2/physics.d.ts +789 -0
  57. package/generated/versions/defold-1.13.2/profiler.d.ts +228 -0
  58. package/generated/versions/defold-1.13.2/render.d.ts +1153 -0
  59. package/generated/versions/defold-1.13.2/resource.d.ts +1628 -0
  60. package/generated/versions/defold-1.13.2/socket.d.ts +797 -0
  61. package/generated/versions/defold-1.13.2/sound.d.ts +323 -0
  62. package/generated/versions/defold-1.13.2/sprite.d.ts +179 -0
  63. package/generated/versions/defold-1.13.2/sys.d.ts +754 -0
  64. package/generated/versions/defold-1.13.2/tilemap.d.ts +206 -0
  65. package/generated/versions/defold-1.13.2/timer.d.ts +136 -0
  66. package/generated/versions/defold-1.13.2/types.d.ts +61 -0
  67. package/generated/versions/defold-1.13.2/vmath.d.ts +775 -0
  68. package/generated/versions/defold-1.13.2/window.d.ts +196 -0
  69. package/generated/versions/defold-1.13.2/zlib.d.ts +41 -0
  70. package/identity-vocabulary.json +1 -0
  71. package/package.json +2 -2
  72. package/scripts/import-defold-release.ts +3 -31
  73. package/scripts/materialize-version.ts +13 -7
  74. package/scripts/regen.ts +63 -29
  75. package/scripts/sync-api-docs.ts +31 -2
  76. package/src/emit-dts.ts +25 -3
@@ -0,0 +1,593 @@
1
+ /** @noSelfInFile */
2
+ import type { Opaque, Vector3 } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions for interacting with Box2D bodies.
7
+ */
8
+ namespace b2d.body {
9
+ type b2Body = Opaque<"b2Body">;
10
+ type b2World = Opaque<"b2World">;
11
+ type B2 = typeof b2d.body.B2_DYNAMIC_BODY | typeof b2d.body.B2_KINEMATIC_BODY | typeof b2d.body.B2_STATIC_BODY;
12
+ /**
13
+ * Dynamic body
14
+ */
15
+ const B2_DYNAMIC_BODY: number & { readonly __brand: "b2d.body.B2_DYNAMIC_BODY" };
16
+ /**
17
+ * Kinematic body
18
+ */
19
+ const B2_KINEMATIC_BODY: number & { readonly __brand: "b2d.body.B2_KINEMATIC_BODY" };
20
+ /**
21
+ * Static (immovable) body
22
+ */
23
+ const B2_STATIC_BODY: number & { readonly __brand: "b2d.body.B2_STATIC_BODY" };
24
+ /**
25
+ * Apply an angular impulse.
26
+ *
27
+ * @param body - body
28
+ * @param impulse - impulse the angular impulse in units of kg*m*m/s
29
+ */
30
+ function apply_angular_impulse(body: Opaque<"b2Body">, impulse: number): void;
31
+ /**
32
+ * Apply a force at a world point. If the force is not
33
+ * applied at the center of mass, it will generate a torque and
34
+ * affect the angular velocity. This wakes up the body.
35
+ *
36
+ * @param body - body
37
+ * @param force - the world force vector, usually in Newtons (N).
38
+ * @param point - the world position of the point of application.
39
+ */
40
+ function apply_force(body: Opaque<"b2Body">, force: Vector3, point: Vector3): void;
41
+ /**
42
+ * Apply a force to the center of mass. This wakes up the body.
43
+ *
44
+ * @param body - body
45
+ * @param force - the world force vector, usually in Newtons (N).
46
+ */
47
+ function apply_force_to_center(body: Opaque<"b2Body">, force: Vector3): void;
48
+ /**
49
+ * Apply an impulse at a point. This immediately modifies the velocity.
50
+ * It also modifies the angular velocity if the point of application
51
+ * is not at the center of mass. This wakes up the body.
52
+ *
53
+ * @param body - body
54
+ * @param impulse - the world impulse vector, usually in N-seconds or kg-m/s.
55
+ * @param point - the world position of the point of application.
56
+ */
57
+ function apply_linear_impulse(body: Opaque<"b2Body">, impulse: Vector3, point: Vector3): void;
58
+ /**
59
+ * Apply a linear impulse to the center of mass.
60
+ *
61
+ * @param body - body
62
+ * @param impulse - world impulse vector
63
+ */
64
+ function apply_linear_impulse_to_center(body: Opaque<"b2Body">, impulse: Vector3): void;
65
+ /**
66
+ * Apply a torque. This affects the angular velocity
67
+ * without affecting the linear velocity of the center of mass.
68
+ * This wakes up the body.
69
+ *
70
+ * @param body - body
71
+ * @param torque - torque about the z-axis (out of the screen), usually in N-m.
72
+ */
73
+ function apply_torque(body: Opaque<"b2Body">, torque: number): void;
74
+ /**
75
+ * Compute the world AABB of all body shapes.
76
+ *
77
+ * @param body - body
78
+ * @returns body bounds
79
+ */
80
+ function compute_aabb(body: Opaque<"b2Body">): b2d.aabb;
81
+ /**
82
+ * Chains are one-sided connected segments with optional ghost vertices at
83
+ * the ends of open chains. Ghost vertices are creation-time chain data only and
84
+ * cannot be added to arbitrary shapes, bodies, or joints after creation.
85
+ *
86
+ * @param body - body
87
+ * @param definition - the chain definition
88
+ * @example
89
+ * ```ts
90
+ * const body = b2d.get_body("#collisionobject");
91
+ * if (body !== undefined) {
92
+ * const [chain, segments] = b2d.body.create_chain(body, {
93
+ * vertices: [vmath.vector3(-64, 0, 0), vmath.vector3(0, 16, 0), vmath.vector3(64, 0, 0)],
94
+ * prev_vertex: vmath.vector3(-96, 0, 0), next_vertex: vmath.vector3(96, 0, 0), friction: 0.6,
95
+ * });
96
+ * }
97
+ * ```
98
+ */
99
+ function create_chain(body: Opaque<"b2Body">, definition: b2d.chain_definition): LuaMultiReturn<[Opaque<"b2Chain">, b2d.shape_info[]]>;
100
+ /**
101
+ * Creates a fixture and attach it to this body. Use this function if you need
102
+ * to set some fixture parameters, like friction. Otherwise you can create the
103
+ * fixture directly from a shape.
104
+ * If the density is non-zero, this function automatically updates the mass of the body.
105
+ * Contacts are not created until the next time step.
106
+ *
107
+ * @param body - body
108
+ * @param definition - fixture definition
109
+ * @returns fixture information. **⚠️ `index` is 1-based; passed to Defold unchanged.**
110
+ * @example
111
+ * ```ts
112
+ * const body = b2d.get_body("#collisionobject");
113
+ * if (body !== undefined) {
114
+ * const triangle = b2d.body.create_fixture(body, {
115
+ * density: 1.0, friction: 0.3,
116
+ * shape: { type: b2d.shape.SHAPE_TYPE_POLYGON, vertices: [vmath.vector3(-16, -16, 0), vmath.vector3(16, -16, 0), vmath.vector3(0, 16, 0)] },
117
+ * });
118
+ * }
119
+ * ```
120
+ */
121
+ function create_fixture(body: Opaque<"b2Body">, definition: { shape: { 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_EDGE; v1: Vector3; v2: Vector3; v0?: Vector3; v3?: Vector3 } | { type: typeof b2d.shape.SHAPE_TYPE_CHAIN; vertices: Vector3[]; loop?: boolean; prev_vertex?: Vector3; next_vertex?: Vector3 }; friction?: number; restitution?: number; density?: number; sensor?: boolean; is_sensor?: boolean; filter?: { category_bits: number; mask_bits: number; group_index: number } }): b2d.fixture_info;
122
+ /**
123
+ * Creates a shape and attaches it to this body.
124
+ * If the density is non-zero, this function automatically updates the mass of the body.
125
+ * Contacts are not created until the next time step.
126
+ *
127
+ * @param body - body
128
+ * @param definition - the shape definition.
129
+ * @returns **⚠️ `index` is 1-based; passed to Defold unchanged.**
130
+ */
131
+ function create_shape(body: Opaque<"b2Body">, definition: ({ shape: { 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 } } | { 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 }) & { density?: number; friction?: number; restitution?: number; material?: number; sensor?: boolean; is_sensor?: boolean; filter?: { category_bits: number; mask_bits: number; group_index: number } }): { index: number; shape_id: Opaque<"b2Shape">; type: number; sensor: boolean; density: number; friction: number; restitution: number; material: number; child_count: number; is_chain_segment: boolean };
132
+ /**
133
+ * Destroy a fixture from a body.
134
+ *
135
+ * @param body - body
136
+ * @param fixture_index - 1-based fixture index from b2d.body.get_fixtures. **⚠️ 1-based; passed to Defold unchanged.**
137
+ */
138
+ function destroy_fixture(body: Opaque<"b2Body">, fixture_index: number): void;
139
+ /**
140
+ * Destroy a shape. This removes the shape from the broad-phase and
141
+ * destroys all contacts associated with this shape. This will
142
+ * automatically adjust the mass of the body if the body is dynamic and the
143
+ * shape has positive density.
144
+ * All shapes attached to a body are implicitly destroyed when the body is destroyed.
145
+ *
146
+ * @param body - body
147
+ * @param shape_index - 1-based shape index from `b2d.body.get_shapes`. **⚠️ 1-based; passed to Defold unchanged.**
148
+ */
149
+ function destroy_shape(body: Opaque<"b2Body">, shape_index: number): void;
150
+ /**
151
+ * Print the body representation to the log output
152
+ *
153
+ * @param body - body
154
+ */
155
+ function dump(body: Opaque<"b2Body">): void;
156
+ /**
157
+ * Enable or disable contact events on all body shapes.
158
+ *
159
+ * @param body - body
160
+ * @param enable - true to enable contact events
161
+ */
162
+ function enable_contact_events(body: Opaque<"b2Body">, enable: boolean): void;
163
+ /**
164
+ * Enable or disable hit events on all body shapes.
165
+ *
166
+ * @param body - body
167
+ * @param enable - true to enable hit events
168
+ */
169
+ function enable_hit_events(body: Opaque<"b2Body">, enable: boolean): void;
170
+ /**
171
+ * You can disable sleeping on this body. If you disable sleeping, the body will be woken.
172
+ *
173
+ * @param body - body
174
+ * @param enable - if false, the body will never sleep, and consume more CPU
175
+ */
176
+ function enable_sleep(body: Opaque<"b2Body">, enable: boolean): void;
177
+ /**
178
+ * Get the angle in radians.
179
+ *
180
+ * @param body - body
181
+ * @returns the current world rotation angle in radians.
182
+ */
183
+ function get_angle(body: Opaque<"b2Body">): number;
184
+ /**
185
+ * Get the angular damping of the body.
186
+ *
187
+ * @param body - body
188
+ * @returns the damping
189
+ */
190
+ function get_angular_damping(body: Opaque<"b2Body">): number;
191
+ /**
192
+ * Get the angular velocity.
193
+ *
194
+ * @param body - body
195
+ * @returns the angular velocity in radians/second.
196
+ */
197
+ function get_angular_velocity(body: Opaque<"b2Body">): number;
198
+ /**
199
+ * Get touching contact data for a body.
200
+ *
201
+ * @param body - body
202
+ * @returns array of contact tables
203
+ */
204
+ function get_contact_data(body: Opaque<"b2Body">): b2d.contact_data[];
205
+ /**
206
+ * Get the fixtures attached to this body.
207
+ *
208
+ * @param body - body
209
+ * @returns the attached fixtures. **⚠️ `index` is 1-based; passed to Defold unchanged.**
210
+ */
211
+ function get_fixtures(body: Opaque<"b2Body">): b2d.fixture_info[];
212
+ /**
213
+ * Get the total force currently applied on this object
214
+ *
215
+ * @param body - body
216
+ */
217
+ function get_force(body: Opaque<"b2Body">): Vector3;
218
+ /**
219
+ * Get the gravity scale of the body.
220
+ *
221
+ * @param body - body
222
+ * @returns the scale
223
+ */
224
+ function get_gravity_scale(body: Opaque<"b2Body">): number;
225
+ /**
226
+ * Get the rotational inertia of the body about the local origin.
227
+ *
228
+ * @param body - body
229
+ * @returns the rotational inertia, usually in kg-m^2.
230
+ */
231
+ function get_inertia(body: Opaque<"b2Body">): number;
232
+ /**
233
+ * Get the joints attached to this body.
234
+ *
235
+ * @param body - body
236
+ * @returns joint handles created by b2d.joint
237
+ */
238
+ function get_joints(body: Opaque<"b2Body">): Opaque<"b2Joint">[];
239
+ /**
240
+ * Get the linear damping of the body.
241
+ *
242
+ * @param body - body
243
+ * @returns the damping
244
+ */
245
+ function get_linear_damping(body: Opaque<"b2Body">): number;
246
+ /**
247
+ * Get the linear velocity of the center of mass.
248
+ *
249
+ * @param body - body
250
+ * @returns the linear velocity of the center of mass.
251
+ */
252
+ function get_linear_velocity(body: Opaque<"b2Body">): Vector3;
253
+ /**
254
+ * Get the world velocity of a local point.
255
+ *
256
+ * @param body - body
257
+ * @param local_point - a point in local coordinates.
258
+ * @returns the world velocity of a point.
259
+ */
260
+ function get_linear_velocity_from_local_point(body: Opaque<"b2Body">, local_point: Vector3): Vector3;
261
+ /**
262
+ * Get the world linear velocity of a world point attached to this body.
263
+ *
264
+ * @param body - body
265
+ * @param world_point - a point in world coordinates.
266
+ * @returns the world velocity of a point.
267
+ */
268
+ function get_linear_velocity_from_world_point(body: Opaque<"b2Body">, world_point: Vector3): Vector3;
269
+ /**
270
+ * Get the local position of the center of mass.
271
+ *
272
+ * @param body - body
273
+ * @returns Get the local position of the center of mass.
274
+ */
275
+ function get_local_center(body: Opaque<"b2Body">): Vector3;
276
+ /**
277
+ * Get the local position of the center of mass.
278
+ *
279
+ * @param body - body
280
+ * @returns Get the local position of the center of mass.
281
+ */
282
+ function get_local_center_of_mass(body: Opaque<"b2Body">): Vector3;
283
+ /**
284
+ * Gets a local point relative to the body's origin given a world point.
285
+ *
286
+ * @param body - body
287
+ * @param world_point - a point in world coordinates.
288
+ * @returns the corresponding local point relative to the body's origin.
289
+ */
290
+ function get_local_point(body: Opaque<"b2Body">, world_point: Vector3): Vector3;
291
+ /**
292
+ * Gets a local vector given a world vector.
293
+ *
294
+ * @param body - body
295
+ * @param world_vector - a vector in world coordinates.
296
+ * @returns the corresponding local vector.
297
+ */
298
+ function get_local_vector(body: Opaque<"b2Body">, world_vector: Vector3): Vector3;
299
+ /**
300
+ * Get the total mass of the body.
301
+ *
302
+ * @param body - body
303
+ * @returns the mass, usually in kilograms (kg).
304
+ */
305
+ function get_mass(body: Opaque<"b2Body">): number;
306
+ /**
307
+ * Get the mass data of the body.
308
+ *
309
+ * @param body - body
310
+ * @returns the mass data
311
+ */
312
+ function get_mass_data(body: Opaque<"b2Body">): b2d.mass_data;
313
+ /**
314
+ * Get the body name.
315
+ *
316
+ * @param body - body
317
+ * @returns body name, or `nil` if no name is set
318
+ */
319
+ function get_name(body: Opaque<"b2Body">): string | undefined;
320
+ /**
321
+ * Get the next body in the world's body list.
322
+ *
323
+ * @param body - body
324
+ * @returns the next body, or `nil` if this is the last body
325
+ */
326
+ function get_next(body: Opaque<"b2Body">): Opaque<"b2Body"> | undefined;
327
+ /**
328
+ * Get the world body origin position.
329
+ *
330
+ * @param body - body
331
+ * @returns the world position of the body's origin.
332
+ */
333
+ function get_position(body: Opaque<"b2Body">): Vector3;
334
+ /**
335
+ * Get the rotational inertia of the body about the local origin.
336
+ *
337
+ * @param body - body
338
+ * @returns the rotational inertia, usually in kg-m^2.
339
+ */
340
+ function get_rotational_inertia(body: Opaque<"b2Body">): number;
341
+ /**
342
+ * Get the list of all shapes attached to this body.
343
+ *
344
+ * @param body - body
345
+ * @returns attached shapes
346
+ */
347
+ function get_shapes(body: Opaque<"b2Body">): b2d.shape_info[];
348
+ /**
349
+ * Get the sleep velocity threshold.
350
+ *
351
+ * @param body - body
352
+ * @returns velocity threshold in Defold units per second
353
+ */
354
+ function get_sleep_threshold(body: Opaque<"b2Body">): number;
355
+ /**
356
+ * Get the body transform for the body's origin.
357
+ *
358
+ * @param body - body
359
+ * @returns the body transform
360
+ */
361
+ function get_transform(body: Opaque<"b2Body">): b2d.transform;
362
+ /**
363
+ * Get the type of this body.
364
+ *
365
+ * @param body - body
366
+ * @returns the body type
367
+ */
368
+ function get_type(body: Opaque<"b2Body">): (number & { readonly __brand: "b2d.body.B2_DYNAMIC_BODY" }) | (number & { readonly __brand: "b2d.body.B2_KINEMATIC_BODY" }) | (number & { readonly __brand: "b2d.body.B2_STATIC_BODY" });
369
+ /**
370
+ * Get the parent world of this body.
371
+ *
372
+ * @param body - body
373
+ */
374
+ function get_world(body: Opaque<"b2Body">): Opaque<"b2World">;
375
+ /**
376
+ * Get the world position of the center of mass.
377
+ *
378
+ * @param body - body
379
+ * @returns Get the world position of the center of mass.
380
+ */
381
+ function get_world_center(body: Opaque<"b2Body">): Vector3;
382
+ /**
383
+ * Get the world position of the center of mass.
384
+ *
385
+ * @param body - body
386
+ * @returns Get the world position of the center of mass.
387
+ */
388
+ function get_world_center_of_mass(body: Opaque<"b2Body">): Vector3;
389
+ /**
390
+ * Get the world coordinates of a point given the local coordinates.
391
+ *
392
+ * @param body - body
393
+ * @param local_vector - localPoint a point on the body measured relative the the body's origin.
394
+ * @returns the same point expressed in world coordinates.
395
+ */
396
+ function get_world_point(body: Opaque<"b2Body">, local_vector: Vector3): Vector3;
397
+ /**
398
+ * Get the world coordinates of a vector given the local coordinates.
399
+ *
400
+ * @param body - body
401
+ * @param local_vector - a vector fixed in the body.
402
+ * @returns the same vector expressed in world coordinates.
403
+ */
404
+ function get_world_vector(body: Opaque<"b2Body">, local_vector: Vector3): Vector3;
405
+ /**
406
+ * Get the active state of the body.
407
+ *
408
+ * @param body - body
409
+ * @returns is the body active
410
+ */
411
+ function is_active(body: Opaque<"b2Body">): boolean;
412
+ /**
413
+ * Get the sleeping state of this body.
414
+ *
415
+ * @param body - body
416
+ * @returns true if the body is awake, false if it's sleeping.
417
+ */
418
+ function is_awake(body: Opaque<"b2Body">): boolean;
419
+ /**
420
+ * Is this body in bullet mode
421
+ *
422
+ * @param body - body
423
+ * @returns true if the body is in bullet mode
424
+ */
425
+ function is_bullet(body: Opaque<"b2Body">): boolean;
426
+ /**
427
+ * Does this body have fixed rotation?
428
+ *
429
+ * @param body - body
430
+ * @returns is the rotation fixed
431
+ */
432
+ function is_fixed_rotation(body: Opaque<"b2Body">): boolean;
433
+ /**
434
+ * Is this body allowed to sleep
435
+ *
436
+ * @param body - body
437
+ * @returns true if the body is allowed to sleep
438
+ */
439
+ function is_sleeping_allowed(body: Opaque<"b2Body">): boolean;
440
+ /**
441
+ * Is this body allowed to sleep
442
+ *
443
+ * @param body - body
444
+ * @returns true if the body is allowed to sleep
445
+ */
446
+ function is_sleeping_enabled(body: Opaque<"b2Body">): boolean;
447
+ /**
448
+ * Validate a body handle.
449
+ *
450
+ * @param body - body
451
+ * @returns true if the body handle still refers to a live Box2D body
452
+ */
453
+ function is_valid(body: Opaque<"b2Body">): boolean;
454
+ /**
455
+ * This resets the mass properties to the sum of the mass properties of the fixtures.
456
+ * This normally does not need to be called unless you called SetMassData to override
457
+ *
458
+ * @param body - body
459
+ */
460
+ function reset_mass_data(body: Opaque<"b2Body">): void;
461
+ /**
462
+ * Set the active state of the body. An inactive body is not
463
+ * simulated and cannot be collided with or woken up.
464
+ * If you pass a flag of true, all fixtures will be added to the
465
+ * broad-phase.
466
+ * If you pass a flag of false, all fixtures will be removed from
467
+ * the broad-phase and all contacts will be destroyed.
468
+ * Fixtures and joints are otherwise unaffected. You may continue
469
+ * to create/destroy fixtures and joints on inactive bodies.
470
+ * Fixtures on an inactive body are implicitly inactive and will
471
+ * not participate in collisions, ray-casts, or queries.
472
+ * Joints connected to an inactive body are implicitly inactive.
473
+ * An inactive body is still owned by a b2World object and remains
474
+ * in the body list.
475
+ *
476
+ * @param body - body
477
+ * @param enable - true if the body should be active
478
+ */
479
+ function set_active(body: Opaque<"b2Body">, enable: boolean): void;
480
+ /**
481
+ * Set the angular damping of the body.
482
+ *
483
+ * @param body - body
484
+ * @param damping - the damping
485
+ */
486
+ function set_angular_damping(body: Opaque<"b2Body">, damping: number): void;
487
+ /**
488
+ * Set the angular velocity.
489
+ *
490
+ * @param body - body
491
+ * @param omega - the new angular velocity in radians/second.
492
+ */
493
+ function set_angular_velocity(body: Opaque<"b2Body">, omega: number): void;
494
+ /**
495
+ * Set the sleep state of the body. A sleeping body has very low CPU cost.
496
+ *
497
+ * @param body - body
498
+ * @param enable - flag set to false to put body to sleep, true to wake it.
499
+ */
500
+ function set_awake(body: Opaque<"b2Body">, enable: boolean): void;
501
+ /**
502
+ * Should this body be treated like a bullet for continuous collision detection?
503
+ *
504
+ * @param body - body
505
+ * @param enable - if true, the body will be in bullet mode
506
+ */
507
+ function set_bullet(body: Opaque<"b2Body">, enable: boolean): void;
508
+ /**
509
+ * Set this body to have fixed rotation. This causes the mass to be reset.
510
+ *
511
+ * @param body - body
512
+ * @param enable - true if the rotation should be fixed
513
+ */
514
+ function set_fixed_rotation(body: Opaque<"b2Body">, enable: boolean): void;
515
+ /**
516
+ * Set the gravity scale of the body.
517
+ *
518
+ * @param body - body
519
+ * @param scale - the scale
520
+ */
521
+ function set_gravity_scale(body: Opaque<"b2Body">, scale: number): void;
522
+ /**
523
+ * Set the linear damping of the body.
524
+ *
525
+ * @param body - body
526
+ * @param damping - the damping
527
+ */
528
+ function set_linear_damping(body: Opaque<"b2Body">, damping: number): void;
529
+ /**
530
+ * Set the linear velocity of the center of mass.
531
+ *
532
+ * @param body - body
533
+ * @param velocity - the new linear velocity of the center of mass.
534
+ */
535
+ function set_linear_velocity(body: Opaque<"b2Body">, velocity: Vector3): void;
536
+ /**
537
+ * Set the mass properties to override the mass properties of the fixtures.
538
+ *
539
+ * @param body - body
540
+ * @param data - the mass data
541
+ */
542
+ function set_mass_data(body: Opaque<"b2Body">, data: b2d.mass_data): void;
543
+ /**
544
+ * Set the body name.
545
+ *
546
+ * @param body - body
547
+ * @param name - body name
548
+ */
549
+ function set_name(body: Opaque<"b2Body">, name: string): void;
550
+ /**
551
+ * Set the sleep velocity threshold.
552
+ *
553
+ * @param body - body
554
+ * @param threshold - velocity threshold in Defold units per second
555
+ */
556
+ function set_sleep_threshold(body: Opaque<"b2Body">, threshold: number): void;
557
+ /**
558
+ * You can disable sleeping on this body. If you disable sleeping, the body will be woken.
559
+ *
560
+ * @param body - body
561
+ * @param enable - if false, the body will never sleep, and consume more CPU
562
+ */
563
+ function set_sleeping_allowed(body: Opaque<"b2Body">, enable: boolean): void;
564
+ /**
565
+ * Set velocity to reach a target transform.
566
+ *
567
+ * @param body - body
568
+ * @param position - target world position
569
+ * @param angle - target world angle in radians
570
+ * @param time_step - time step used to compute velocity
571
+ */
572
+ function set_target_transform(body: Opaque<"b2Body">, position: Vector3, angle: number, time_step: number): void;
573
+ /**
574
+ * Set the position of the body's origin and rotation.
575
+ * This breaks any contacts and wakes the other bodies.
576
+ * Manipulating a body's transform may cause non-physical behavior.
577
+ *
578
+ * @param body - body
579
+ * @param position - the world position of the body's local origin.
580
+ * @param angle - the world position of the body's local origin.
581
+ */
582
+ function set_transform(body: Opaque<"b2Body">, position: Vector3, angle: number): void;
583
+ /**
584
+ * Set the type of this body. This may alter the mass and velocity.
585
+ *
586
+ * @param body - body
587
+ * @param type - the body type
588
+ */
589
+ function set_type(body: Opaque<"b2Body">, type: (number & { readonly __brand: "b2d.body.B2_DYNAMIC_BODY" }) | (number & { readonly __brand: "b2d.body.B2_KINEMATIC_BODY" }) | (number & { readonly __brand: "b2d.body.B2_STATIC_BODY" })): void;
590
+ }
591
+ }
592
+
593
+ export {};
@@ -0,0 +1,105 @@
1
+ /** @noSelfInFile */
2
+ import type { Opaque } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions for Box2D v3 chains. A chain owns multiple connected segment
7
+ * shapes, so it is represented by a separate `b2Chain` handle.
8
+ */
9
+ namespace b2d.chain {
10
+ type b2Chain = Opaque<"b2Chain">;
11
+ /**
12
+ * Destroying a chain removes all segment shapes owned by the chain. Destroying
13
+ * any segment shape through `b2d.body.destroy_shape` also destroys its parent chain.
14
+ *
15
+ * @param chain - chain
16
+ */
17
+ function destroy(chain: Opaque<"b2Chain">): void;
18
+ /**
19
+ * Returns `nil` if the shape is not a chain segment.
20
+ *
21
+ * @param shape_id - shape handle from a shape info table, or pass `body, shape_index`
22
+ * @returns parent chain, or `nil` if the shape is not a chain segment
23
+ */
24
+ function from_shape(shape_id: Opaque<"b2Shape">): Opaque<"b2Chain"> | undefined;
25
+ /**
26
+ * Get chain friction.
27
+ *
28
+ * @param chain - chain
29
+ * @returns chain friction
30
+ */
31
+ function get_friction(chain: Opaque<"b2Chain">): number;
32
+ /**
33
+ * Get the chain geometry.
34
+ *
35
+ * @param chain - chain
36
+ * @returns chain geometry
37
+ */
38
+ function get_geometry(chain: Opaque<"b2Chain">): b2d.chain_geometry;
39
+ /**
40
+ * Get chain material id.
41
+ *
42
+ * @param chain - chain
43
+ * @returns chain material id
44
+ */
45
+ function get_material(chain: Opaque<"b2Chain">): number;
46
+ /**
47
+ * Get chain restitution.
48
+ *
49
+ * @param chain - chain
50
+ * @returns chain restitution
51
+ */
52
+ function get_restitution(chain: Opaque<"b2Chain">): number;
53
+ /**
54
+ * Get the number of segment shapes in a chain.
55
+ *
56
+ * @param chain - chain
57
+ * @returns segment count
58
+ */
59
+ function get_segment_count(chain: Opaque<"b2Chain">): number;
60
+ /**
61
+ * Get the segment shapes owned by a chain.
62
+ *
63
+ * @param chain - chain
64
+ * @returns chain segment shapes
65
+ */
66
+ function get_segments(chain: Opaque<"b2Chain">): b2d.shape_info[];
67
+ /**
68
+ * Get the world owning a chain.
69
+ *
70
+ * @param chain - chain
71
+ * @returns owning world
72
+ */
73
+ function get_world(chain: Opaque<"b2Chain">): Opaque<"b2World">;
74
+ /**
75
+ * Validate a chain handle.
76
+ *
77
+ * @param chain - chain
78
+ * @returns true if the chain handle still refers to a live Box2D chain
79
+ */
80
+ function is_valid(chain: Opaque<"b2Chain">): boolean;
81
+ /**
82
+ * Set chain friction.
83
+ *
84
+ * @param chain - chain
85
+ * @param friction - chain friction
86
+ */
87
+ function set_friction(chain: Opaque<"b2Chain">, friction: number): void;
88
+ /**
89
+ * Set chain material id.
90
+ *
91
+ * @param chain - chain
92
+ * @param material - chain material id
93
+ */
94
+ function set_material(chain: Opaque<"b2Chain">, material: number): void;
95
+ /**
96
+ * Set chain restitution.
97
+ *
98
+ * @param chain - chain
99
+ * @param restitution - chain restitution
100
+ */
101
+ function set_restitution(chain: Opaque<"b2Chain">, restitution: number): void;
102
+ }
103
+ }
104
+
105
+ export {};