@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.
- 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,818 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import type { Opaque, Quaternion, Vector3 } from "../../../src/core-types";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Creates and controls Bullet constraints between Defold rigid bodies. A
|
|
7
|
+
* constraint belongs to the supplied world and is destroyed automatically
|
|
8
|
+
* with either body, with the world, or when the module is finalized. It is
|
|
9
|
+
* temporarily removed from the native world while either linked body is
|
|
10
|
+
* disabled and is restored when both bodies are enabled again. Dropping its
|
|
11
|
+
* Lua userdata does not destroy the native constraint; call `destroy` for
|
|
12
|
+
* early release.
|
|
13
|
+
*
|
|
14
|
+
* Creator positions and all other linear values use Defold units and are
|
|
15
|
+
* converted with `physics.scale`. Angles are radians. Axes are one-based in
|
|
16
|
+
* Lua: axes 1-3 are linear and axes 4-6 are angular. Mutating functions cannot
|
|
17
|
+
* be called while the physics world is stepping. Floating-point and vector
|
|
18
|
+
* inputs must be finite. Axis vectors must be non-zero and are normalized.
|
|
19
|
+
* Input rotations must be finite, non-zero quaternions and are normalized by
|
|
20
|
+
* the binding.
|
|
21
|
+
*
|
|
22
|
+
* `CONSTRAINT_TYPE_*` values identify the concrete constraint exposed by this
|
|
23
|
+
* binding. This deliberately distinguishes universal, hinge2, and spring 6-DOF
|
|
24
|
+
* constraints independently of Bullet's internal constraint type hierarchy.
|
|
25
|
+
*/
|
|
26
|
+
namespace bullet3d.constraint {
|
|
27
|
+
/**
|
|
28
|
+
* Universal and hinge2 constraint parameters
|
|
29
|
+
*/
|
|
30
|
+
interface anchor_axes_params {
|
|
31
|
+
/**
|
|
32
|
+
* world-space anchor
|
|
33
|
+
*/
|
|
34
|
+
anchor: Vector3;
|
|
35
|
+
/**
|
|
36
|
+
* first non-zero world-space axis
|
|
37
|
+
*/
|
|
38
|
+
axis1: Vector3;
|
|
39
|
+
/**
|
|
40
|
+
* second non-zero world-space axis, orthogonal to `axis1`
|
|
41
|
+
*/
|
|
42
|
+
axis2: Vector3;
|
|
43
|
+
/**
|
|
44
|
+
* whether connected bodies can collide; defaults to `false`
|
|
45
|
+
*/
|
|
46
|
+
collide_connected?: boolean;
|
|
47
|
+
}
|
|
48
|
+
type btTypedConstraint = Opaque<"btTypedConstraint">;
|
|
49
|
+
/**
|
|
50
|
+
* The frame-B fields are required for a two-body constraint.
|
|
51
|
+
*/
|
|
52
|
+
interface cone_twist_params {
|
|
53
|
+
/**
|
|
54
|
+
* local body-A frame position
|
|
55
|
+
*/
|
|
56
|
+
frame_a_position: Vector3;
|
|
57
|
+
/**
|
|
58
|
+
* local body-A frame rotation
|
|
59
|
+
*/
|
|
60
|
+
frame_a_rotation: Quaternion;
|
|
61
|
+
/**
|
|
62
|
+
* local body-B frame position
|
|
63
|
+
*/
|
|
64
|
+
frame_b_position?: Vector3;
|
|
65
|
+
/**
|
|
66
|
+
* local body-B frame rotation
|
|
67
|
+
*/
|
|
68
|
+
frame_b_rotation?: Quaternion;
|
|
69
|
+
/**
|
|
70
|
+
* whether to constrain angular motion only
|
|
71
|
+
*/
|
|
72
|
+
angular_only?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* whether connected bodies can collide; defaults to `false`
|
|
75
|
+
*/
|
|
76
|
+
collide_connected?: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The frame-B fields are required for a two-body constraint.
|
|
80
|
+
*/
|
|
81
|
+
interface generic_6dof_params {
|
|
82
|
+
/**
|
|
83
|
+
* local body-A frame position
|
|
84
|
+
*/
|
|
85
|
+
frame_a_position: Vector3;
|
|
86
|
+
/**
|
|
87
|
+
* local body-A frame rotation
|
|
88
|
+
*/
|
|
89
|
+
frame_a_rotation: Quaternion;
|
|
90
|
+
/**
|
|
91
|
+
* local body-B frame position
|
|
92
|
+
*/
|
|
93
|
+
frame_b_position?: Vector3;
|
|
94
|
+
/**
|
|
95
|
+
* local body-B frame rotation
|
|
96
|
+
*/
|
|
97
|
+
frame_b_rotation?: Quaternion;
|
|
98
|
+
/**
|
|
99
|
+
* whether connected bodies can collide; defaults to `false`
|
|
100
|
+
*/
|
|
101
|
+
collide_connected?: boolean;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Generic spring 6-DOF constraint parameters
|
|
105
|
+
*/
|
|
106
|
+
interface generic_6dof_spring_params {
|
|
107
|
+
/**
|
|
108
|
+
* local body-A frame position
|
|
109
|
+
*/
|
|
110
|
+
frame_a_position: Vector3;
|
|
111
|
+
/**
|
|
112
|
+
* local body-A frame rotation
|
|
113
|
+
*/
|
|
114
|
+
frame_a_rotation: Quaternion;
|
|
115
|
+
/**
|
|
116
|
+
* local body-B frame position
|
|
117
|
+
*/
|
|
118
|
+
frame_b_position: Vector3;
|
|
119
|
+
/**
|
|
120
|
+
* local body-B frame rotation
|
|
121
|
+
*/
|
|
122
|
+
frame_b_rotation: Quaternion;
|
|
123
|
+
/**
|
|
124
|
+
* whether connected bodies can collide; defaults to `false`
|
|
125
|
+
*/
|
|
126
|
+
collide_connected?: boolean;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The frame-B fields are required for a two-body constraint.
|
|
130
|
+
*/
|
|
131
|
+
interface hinge_params {
|
|
132
|
+
/**
|
|
133
|
+
* local body-A frame position
|
|
134
|
+
*/
|
|
135
|
+
frame_a_position: Vector3;
|
|
136
|
+
/**
|
|
137
|
+
* local body-A frame rotation
|
|
138
|
+
*/
|
|
139
|
+
frame_a_rotation: Quaternion;
|
|
140
|
+
/**
|
|
141
|
+
* local body-B frame position
|
|
142
|
+
*/
|
|
143
|
+
frame_b_position?: Vector3;
|
|
144
|
+
/**
|
|
145
|
+
* local body-B frame rotation
|
|
146
|
+
*/
|
|
147
|
+
frame_b_rotation?: Quaternion;
|
|
148
|
+
/**
|
|
149
|
+
* whether angular calculations reference frame A
|
|
150
|
+
*/
|
|
151
|
+
use_reference_frame_a?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* whether to constrain angular motion only
|
|
154
|
+
*/
|
|
155
|
+
angular_only?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* whether connected bodies can collide; defaults to `false`
|
|
158
|
+
*/
|
|
159
|
+
collide_connected?: boolean;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* `pivot_b` is required for a two-body constraint. For a one-body constraint,
|
|
163
|
+
* it is an optional world-space anchor.
|
|
164
|
+
*/
|
|
165
|
+
interface point_to_point_params {
|
|
166
|
+
/**
|
|
167
|
+
* local body-A pivot
|
|
168
|
+
*/
|
|
169
|
+
pivot_a: Vector3;
|
|
170
|
+
/**
|
|
171
|
+
* local body-B pivot or world-space anchor
|
|
172
|
+
*/
|
|
173
|
+
pivot_b?: Vector3;
|
|
174
|
+
/**
|
|
175
|
+
* whether connected bodies can collide; defaults to `false`
|
|
176
|
+
*/
|
|
177
|
+
collide_connected?: boolean;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The frame-B fields are required for a two-body constraint.
|
|
181
|
+
*/
|
|
182
|
+
interface slider_params {
|
|
183
|
+
/**
|
|
184
|
+
* local body-A frame position
|
|
185
|
+
*/
|
|
186
|
+
frame_a_position: Vector3;
|
|
187
|
+
/**
|
|
188
|
+
* local body-A frame rotation
|
|
189
|
+
*/
|
|
190
|
+
frame_a_rotation: Quaternion;
|
|
191
|
+
/**
|
|
192
|
+
* local body-B frame position
|
|
193
|
+
*/
|
|
194
|
+
frame_b_position?: Vector3;
|
|
195
|
+
/**
|
|
196
|
+
* local body-B frame rotation
|
|
197
|
+
*/
|
|
198
|
+
frame_b_rotation?: Quaternion;
|
|
199
|
+
/**
|
|
200
|
+
* whether linear calculations reference frame A
|
|
201
|
+
*/
|
|
202
|
+
use_linear_reference_frame_a?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* whether connected bodies can collide; defaults to `false`
|
|
205
|
+
*/
|
|
206
|
+
collide_connected?: boolean;
|
|
207
|
+
}
|
|
208
|
+
type CONSTRAINT_TYPE = typeof bullet3d.constraint.CONSTRAINT_TYPE_CONE_TWIST | typeof bullet3d.constraint.CONSTRAINT_TYPE_GENERIC_6DOF | typeof bullet3d.constraint.CONSTRAINT_TYPE_GENERIC_6DOF_SPRING | typeof bullet3d.constraint.CONSTRAINT_TYPE_HINGE | typeof bullet3d.constraint.CONSTRAINT_TYPE_HINGE2 | typeof bullet3d.constraint.CONSTRAINT_TYPE_POINT_TO_POINT | typeof bullet3d.constraint.CONSTRAINT_TYPE_SLIDER | typeof bullet3d.constraint.CONSTRAINT_TYPE_UNIVERSAL;
|
|
209
|
+
/**
|
|
210
|
+
* Cone-twist constraint type
|
|
211
|
+
*/
|
|
212
|
+
const CONSTRAINT_TYPE_CONE_TWIST: number & { readonly __brand: "bullet3d.constraint.CONSTRAINT_TYPE_CONE_TWIST" };
|
|
213
|
+
/**
|
|
214
|
+
* Generic 6-DOF constraint type
|
|
215
|
+
*/
|
|
216
|
+
const CONSTRAINT_TYPE_GENERIC_6DOF: number & { readonly __brand: "bullet3d.constraint.CONSTRAINT_TYPE_GENERIC_6DOF" };
|
|
217
|
+
/**
|
|
218
|
+
* Generic spring 6-DOF constraint type
|
|
219
|
+
*/
|
|
220
|
+
const CONSTRAINT_TYPE_GENERIC_6DOF_SPRING: number & { readonly __brand: "bullet3d.constraint.CONSTRAINT_TYPE_GENERIC_6DOF_SPRING" };
|
|
221
|
+
/**
|
|
222
|
+
* Hinge constraint type
|
|
223
|
+
*/
|
|
224
|
+
const CONSTRAINT_TYPE_HINGE: number & { readonly __brand: "bullet3d.constraint.CONSTRAINT_TYPE_HINGE" };
|
|
225
|
+
/**
|
|
226
|
+
* Hinge2 constraint type
|
|
227
|
+
*/
|
|
228
|
+
const CONSTRAINT_TYPE_HINGE2: number & { readonly __brand: "bullet3d.constraint.CONSTRAINT_TYPE_HINGE2" };
|
|
229
|
+
/**
|
|
230
|
+
* Point-to-point constraint type
|
|
231
|
+
*/
|
|
232
|
+
const CONSTRAINT_TYPE_POINT_TO_POINT: number & { readonly __brand: "bullet3d.constraint.CONSTRAINT_TYPE_POINT_TO_POINT" };
|
|
233
|
+
/**
|
|
234
|
+
* Slider constraint type
|
|
235
|
+
*/
|
|
236
|
+
const CONSTRAINT_TYPE_SLIDER: number & { readonly __brand: "bullet3d.constraint.CONSTRAINT_TYPE_SLIDER" };
|
|
237
|
+
/**
|
|
238
|
+
* Universal constraint type
|
|
239
|
+
*/
|
|
240
|
+
const CONSTRAINT_TYPE_UNIVERSAL: number & { readonly __brand: "bullet3d.constraint.CONSTRAINT_TYPE_UNIVERSAL" };
|
|
241
|
+
/**
|
|
242
|
+
* The world is derived from `body_a`.
|
|
243
|
+
*
|
|
244
|
+
* @param body_a - first body
|
|
245
|
+
* @param body_b - second body or world
|
|
246
|
+
* @param params - local frames and options
|
|
247
|
+
* @returns cone-twist constraint
|
|
248
|
+
*/
|
|
249
|
+
function create_cone_twist(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.cone_twist_params): bullet3d.constraint.btTypedConstraint;
|
|
250
|
+
/**
|
|
251
|
+
* The params table requires local frame A and, for a two-body constraint,
|
|
252
|
+
* local frame B. It optionally accepts `collide_connected`. The world is
|
|
253
|
+
* derived from `body_a`. The active 6-DOF solver ignores its legacy
|
|
254
|
+
* linear-reference-frame selector, so that field is rejected rather than
|
|
255
|
+
* silently accepted.
|
|
256
|
+
*
|
|
257
|
+
* @param body_a - first body
|
|
258
|
+
* @param body_b - second body or world
|
|
259
|
+
* @param params - local frames and options
|
|
260
|
+
* @returns generic 6-DOF constraint
|
|
261
|
+
*/
|
|
262
|
+
function create_generic_6dof(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.generic_6dof_params): bullet3d.constraint.btTypedConstraint;
|
|
263
|
+
/**
|
|
264
|
+
* Both bodies and both local frames are required. The params table optionally
|
|
265
|
+
* accepts `collide_connected`. The world is derived from `body_a`. The active
|
|
266
|
+
* spring 6-DOF solver ignores its legacy linear-reference-frame selector, so
|
|
267
|
+
* that field is rejected rather than silently accepted.
|
|
268
|
+
*
|
|
269
|
+
* @param body_a - first body
|
|
270
|
+
* @param body_b - second body
|
|
271
|
+
* @param params - local frames and options
|
|
272
|
+
* @returns spring 6-DOF constraint
|
|
273
|
+
* @example
|
|
274
|
+
* ```ts
|
|
275
|
+
* // Create a spring that moves along its first linear axis:
|
|
276
|
+
* export default defineScript({
|
|
277
|
+
* init() {
|
|
278
|
+
* const body_a = bullet3d.get_rigid_body("/body_a#collisionobject");
|
|
279
|
+
* const body_b = bullet3d.get_rigid_body("/body_b#collisionobject");
|
|
280
|
+
* let spring: bullet3d.constraint.btTypedConstraint | undefined;
|
|
281
|
+
* if (body_a !== undefined && body_b !== undefined) {
|
|
282
|
+
* spring = bullet3d.constraint.create_generic_6dof_spring(body_a, body_b, {
|
|
283
|
+
* frame_a_position: vmath.vector3(),
|
|
284
|
+
* frame_a_rotation: vmath.quat(),
|
|
285
|
+
* frame_b_position: vmath.vector3(),
|
|
286
|
+
* frame_b_rotation: vmath.quat(),
|
|
287
|
+
* });
|
|
288
|
+
* bullet3d.constraint.set_limit(spring, 1, -1, 1);
|
|
289
|
+
* bullet3d.constraint.enable_spring(spring, 1, true);
|
|
290
|
+
* bullet3d.constraint.set_spring_stiffness(spring, 1, 20);
|
|
291
|
+
* bullet3d.constraint.set_spring_damping(spring, 1, 0.5);
|
|
292
|
+
* bullet3d.constraint.set_spring_equilibrium_point(spring, 1, 0);
|
|
293
|
+
* }
|
|
294
|
+
* return { spring };
|
|
295
|
+
* },
|
|
296
|
+
*
|
|
297
|
+
* final(self) {
|
|
298
|
+
* if (self.spring !== undefined && bullet3d.constraint.is_valid(self.spring)) {
|
|
299
|
+
* bullet3d.constraint.destroy(self.spring);
|
|
300
|
+
* }
|
|
301
|
+
* },
|
|
302
|
+
* });
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
function create_generic_6dof_spring(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody">, params: bullet3d.constraint.generic_6dof_spring_params): bullet3d.constraint.btTypedConstraint;
|
|
306
|
+
/**
|
|
307
|
+
* The world is derived from `body_a`.
|
|
308
|
+
*
|
|
309
|
+
* @param body_a - first body
|
|
310
|
+
* @param body_b - second body or world
|
|
311
|
+
* @param params - local frames and options
|
|
312
|
+
* @returns hinge constraint
|
|
313
|
+
* @example
|
|
314
|
+
* ```ts
|
|
315
|
+
* // Create a motorized hinge with a 90-degree range:
|
|
316
|
+
* export default defineScript({
|
|
317
|
+
* init() {
|
|
318
|
+
* const body_a = bullet3d.get_rigid_body("/door#collisionobject");
|
|
319
|
+
* const body_b = bullet3d.get_rigid_body("/frame#collisionobject");
|
|
320
|
+
* let hinge: bullet3d.constraint.btTypedConstraint | undefined;
|
|
321
|
+
* if (body_a !== undefined) {
|
|
322
|
+
* hinge = bullet3d.constraint.create_hinge(body_a, body_b, {
|
|
323
|
+
* frame_a_position: vmath.vector3(-0.5, 0, 0),
|
|
324
|
+
* frame_a_rotation: vmath.quat(),
|
|
325
|
+
* frame_b_position: vmath.vector3(0.5, 0, 0),
|
|
326
|
+
* frame_b_rotation: vmath.quat(),
|
|
327
|
+
* });
|
|
328
|
+
* bullet3d.constraint.set_hinge_limits(hinge, -math.pi / 4, math.pi / 4);
|
|
329
|
+
* bullet3d.constraint.set_hinge_motor(hinge, true, 1.5, 2.5);
|
|
330
|
+
* }
|
|
331
|
+
* return { hinge };
|
|
332
|
+
* },
|
|
333
|
+
*
|
|
334
|
+
* final(self) {
|
|
335
|
+
* if (self.hinge !== undefined && bullet3d.constraint.is_valid(self.hinge)) {
|
|
336
|
+
* bullet3d.constraint.destroy(self.hinge);
|
|
337
|
+
* }
|
|
338
|
+
* },
|
|
339
|
+
* });
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
function create_hinge(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.hinge_params): bullet3d.constraint.btTypedConstraint;
|
|
343
|
+
/**
|
|
344
|
+
* Both bodies are required. Its initial linear suspension travel is one Defold
|
|
345
|
+
* unit in either direction. The world is derived from `body_a`.
|
|
346
|
+
*
|
|
347
|
+
* @param body_a - first body
|
|
348
|
+
* @param body_b - second body
|
|
349
|
+
* @param params - anchor, axes, and options
|
|
350
|
+
* @returns hinge2 constraint
|
|
351
|
+
*/
|
|
352
|
+
function create_hinge2(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody">, params: bullet3d.constraint.anchor_axes_params): bullet3d.constraint.btTypedConstraint;
|
|
353
|
+
/**
|
|
354
|
+
* The world is derived from `body_a`; both bodies must belong to that same world.
|
|
355
|
+
*
|
|
356
|
+
* @param body_a - first body
|
|
357
|
+
* @param body_b - second body or world
|
|
358
|
+
* @param params - pivots and options
|
|
359
|
+
* @returns point-to-point constraint
|
|
360
|
+
* @example
|
|
361
|
+
* ```ts
|
|
362
|
+
* // Join two bodies at matching local pivots and explicitly destroy the
|
|
363
|
+
* // constraint when the script is finalized:
|
|
364
|
+
* export default defineScript({
|
|
365
|
+
* init() {
|
|
366
|
+
* const body_a = bullet3d.get_rigid_body("/body_a#collisionobject");
|
|
367
|
+
* const body_b = bullet3d.get_rigid_body("/body_b#collisionobject");
|
|
368
|
+
* let constraint: bullet3d.constraint.btTypedConstraint | undefined;
|
|
369
|
+
* if (body_a !== undefined) {
|
|
370
|
+
* constraint = bullet3d.constraint.create_point_to_point(body_a, body_b, {
|
|
371
|
+
* pivot_a: vmath.vector3(0.5, 0, 0),
|
|
372
|
+
* pivot_b: vmath.vector3(-0.5, 0, 0),
|
|
373
|
+
* });
|
|
374
|
+
* }
|
|
375
|
+
* return { constraint };
|
|
376
|
+
* },
|
|
377
|
+
*
|
|
378
|
+
* final(self) {
|
|
379
|
+
* if (self.constraint !== undefined && bullet3d.constraint.is_valid(self.constraint)) {
|
|
380
|
+
* bullet3d.constraint.destroy(self.constraint);
|
|
381
|
+
* }
|
|
382
|
+
* },
|
|
383
|
+
* });
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
386
|
+
function create_point_to_point(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.point_to_point_params): bullet3d.constraint.btTypedConstraint;
|
|
387
|
+
/**
|
|
388
|
+
* The world is derived from `body_a`.
|
|
389
|
+
*
|
|
390
|
+
* @param body_a - first body
|
|
391
|
+
* @param body_b - second body or world
|
|
392
|
+
* @param params - local frames and options
|
|
393
|
+
* @returns slider constraint
|
|
394
|
+
*/
|
|
395
|
+
function create_slider(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody"> | undefined, params: bullet3d.constraint.slider_params): bullet3d.constraint.btTypedConstraint;
|
|
396
|
+
/**
|
|
397
|
+
* Both bodies are required. The world is derived from `body_a`.
|
|
398
|
+
*
|
|
399
|
+
* @param body_a - first body
|
|
400
|
+
* @param body_b - second body
|
|
401
|
+
* @param params - anchor, axes, and options
|
|
402
|
+
* @returns universal constraint
|
|
403
|
+
*/
|
|
404
|
+
function create_universal(body_a: Opaque<"btRigidBody">, body_b: Opaque<"btRigidBody">, params: bullet3d.constraint.anchor_axes_params): bullet3d.constraint.btTypedConstraint;
|
|
405
|
+
/**
|
|
406
|
+
* Destroy a constraint
|
|
407
|
+
*
|
|
408
|
+
* @param constraint - constraint
|
|
409
|
+
*/
|
|
410
|
+
function destroy(constraint: bullet3d.constraint.btTypedConstraint): void;
|
|
411
|
+
/**
|
|
412
|
+
* Enable or disable the cone-twist motor
|
|
413
|
+
*
|
|
414
|
+
* @param constraint - cone-twist constraint
|
|
415
|
+
* @param enabled - motor state
|
|
416
|
+
*/
|
|
417
|
+
function enable_cone_twist_motor(constraint: bullet3d.constraint.btTypedConstraint, enabled: boolean): void;
|
|
418
|
+
/**
|
|
419
|
+
* Enable or disable a spring axis
|
|
420
|
+
*
|
|
421
|
+
* @param constraint - spring 6-DOF or hinge2 constraint
|
|
422
|
+
* @param axis - one-based axis from 1 to 6. **⚠️ 1-based; passed to Defold unchanged.**
|
|
423
|
+
* @param enabled - spring state
|
|
424
|
+
*/
|
|
425
|
+
function enable_spring(constraint: bullet3d.constraint.btTypedConstraint, axis: number, enabled: boolean): void;
|
|
426
|
+
/**
|
|
427
|
+
* Get a current 6-DOF angle
|
|
428
|
+
*
|
|
429
|
+
* @param constraint - 6-DOF-derived constraint
|
|
430
|
+
* @param axis - one-based angular-axis index from 1 to 3. **⚠️ 1-based; passed to Defold unchanged.**
|
|
431
|
+
* @returns current angle in radians
|
|
432
|
+
*/
|
|
433
|
+
function get_6dof_angle(constraint: bullet3d.constraint.btTypedConstraint, axis: number): number;
|
|
434
|
+
/**
|
|
435
|
+
* Get a current 6-DOF angular axis
|
|
436
|
+
*
|
|
437
|
+
* @param constraint - 6-DOF-derived constraint
|
|
438
|
+
* @param axis - one-based angular-axis index from 1 to 3. **⚠️ 1-based; passed to Defold unchanged.**
|
|
439
|
+
* @returns world-space unit axis
|
|
440
|
+
*/
|
|
441
|
+
function get_6dof_axis(constraint: bullet3d.constraint.btTypedConstraint, axis: number): Vector3;
|
|
442
|
+
/**
|
|
443
|
+
* Axes 1-3 are linear and axes 4-6 are angular. Generic 6-DOF, generic spring
|
|
444
|
+
* 6-DOF, and universal constraints support bounce only on angular axes; hinge2
|
|
445
|
+
* supports it on every axis. Linear target velocity uses Defold units per
|
|
446
|
+
* second and angular target velocity uses radians per second. `max_force` is a
|
|
447
|
+
* force for linear axes and a torque in Defold squared units for angular axes.
|
|
448
|
+
*
|
|
449
|
+
* @param constraint - 6-DOF-derived constraint
|
|
450
|
+
* @param axis - one-based axis from 1 to 6. **⚠️ 1-based; passed to Defold unchanged.**
|
|
451
|
+
*/
|
|
452
|
+
function get_6dof_motor(constraint: bullet3d.constraint.btTypedConstraint, axis: number): LuaMultiReturn<[boolean, number, number, number]>;
|
|
453
|
+
/**
|
|
454
|
+
* Get a current 6-DOF linear position
|
|
455
|
+
*
|
|
456
|
+
* @param constraint - 6-DOF-derived constraint
|
|
457
|
+
* @param axis - one-based linear-axis index from 1 to 3. **⚠️ 1-based; passed to Defold unchanged.**
|
|
458
|
+
* @returns relative position in Defold units
|
|
459
|
+
*/
|
|
460
|
+
function get_6dof_position(constraint: bullet3d.constraint.btTypedConstraint, axis: number): number;
|
|
461
|
+
/**
|
|
462
|
+
* Get universal or hinge2 anchors
|
|
463
|
+
*
|
|
464
|
+
* @param constraint - universal or hinge2 constraint
|
|
465
|
+
*/
|
|
466
|
+
function get_anchors(constraint: bullet3d.constraint.btTypedConstraint): LuaMultiReturn<[Vector3, Vector3]>;
|
|
467
|
+
/**
|
|
468
|
+
* Get universal or hinge2 angles
|
|
469
|
+
*
|
|
470
|
+
* @param constraint - universal or hinge2 constraint
|
|
471
|
+
*/
|
|
472
|
+
function get_angles(constraint: bullet3d.constraint.btTypedConstraint): LuaMultiReturn<[number, number]>;
|
|
473
|
+
/**
|
|
474
|
+
* Get universal or hinge2 axes
|
|
475
|
+
*
|
|
476
|
+
* @param constraint - universal or hinge2 constraint
|
|
477
|
+
*/
|
|
478
|
+
function get_axes(constraint: bullet3d.constraint.btTypedConstraint): LuaMultiReturn<[Vector3, Vector3]>;
|
|
479
|
+
/**
|
|
480
|
+
* Get the first linked body
|
|
481
|
+
*
|
|
482
|
+
* @param constraint - constraint
|
|
483
|
+
* @returns first body
|
|
484
|
+
*/
|
|
485
|
+
function get_body_a(constraint: bullet3d.constraint.btTypedConstraint): Opaque<"btRigidBody">;
|
|
486
|
+
/**
|
|
487
|
+
* Get the second linked body
|
|
488
|
+
*
|
|
489
|
+
* @param constraint - constraint
|
|
490
|
+
* @returns second body, or nil for a world constraint
|
|
491
|
+
*/
|
|
492
|
+
function get_body_b(constraint: bullet3d.constraint.btTypedConstraint): Opaque<"btRigidBody"> | undefined;
|
|
493
|
+
/**
|
|
494
|
+
* Get whether connected bodies can collide
|
|
495
|
+
*
|
|
496
|
+
* @param constraint - constraint
|
|
497
|
+
* @returns whether connected bodies can collide
|
|
498
|
+
*/
|
|
499
|
+
function get_collide_connected(constraint: bullet3d.constraint.btTypedConstraint): boolean;
|
|
500
|
+
/**
|
|
501
|
+
* Get cone-twist angular spans
|
|
502
|
+
*
|
|
503
|
+
* @param constraint - cone-twist constraint
|
|
504
|
+
*/
|
|
505
|
+
function get_cone_twist_limits(constraint: bullet3d.constraint.btTypedConstraint): LuaMultiReturn<[number, number, number]>;
|
|
506
|
+
/**
|
|
507
|
+
* Supported constraint types are hinge, cone-twist, generic 6-DOF, generic
|
|
508
|
+
* spring 6-DOF, slider, universal, and hinge2. Point-to-point constraints use
|
|
509
|
+
* `get_pivots` instead.
|
|
510
|
+
* Returns position and rotation. For one-body generic 6-DOF and slider
|
|
511
|
+
* constraints this is the user-body frame, despite Bullet storing it as its
|
|
512
|
+
* native frame B.
|
|
513
|
+
*
|
|
514
|
+
* @param constraint - framed constraint
|
|
515
|
+
*/
|
|
516
|
+
function get_frame_a(constraint: bullet3d.constraint.btTypedConstraint): LuaMultiReturn<[Vector3, Quaternion]>;
|
|
517
|
+
/**
|
|
518
|
+
* Supports the same constraint types as `get_frame_a`. For a one-body
|
|
519
|
+
* constraint, this is the frame attached to the fixed world body.
|
|
520
|
+
*
|
|
521
|
+
* @param constraint - framed constraint
|
|
522
|
+
*/
|
|
523
|
+
function get_frame_b(constraint: bullet3d.constraint.btTypedConstraint): LuaMultiReturn<[Vector3, Quaternion]>;
|
|
524
|
+
/**
|
|
525
|
+
* Get the current hinge angle
|
|
526
|
+
*
|
|
527
|
+
* @param constraint - hinge constraint
|
|
528
|
+
* @returns angle in radians
|
|
529
|
+
*/
|
|
530
|
+
function get_hinge_angle(constraint: bullet3d.constraint.btTypedConstraint): number;
|
|
531
|
+
/**
|
|
532
|
+
* Get hinge angular limits
|
|
533
|
+
*
|
|
534
|
+
* @param constraint - hinge constraint
|
|
535
|
+
*/
|
|
536
|
+
function get_hinge_limits(constraint: bullet3d.constraint.btTypedConstraint): LuaMultiReturn<[number, number]>;
|
|
537
|
+
/**
|
|
538
|
+
* Get hinge motor settings
|
|
539
|
+
*
|
|
540
|
+
* @param constraint - hinge constraint
|
|
541
|
+
*/
|
|
542
|
+
function get_hinge_motor(constraint: bullet3d.constraint.btTypedConstraint): LuaMultiReturn<[boolean, number, number]>;
|
|
543
|
+
/**
|
|
544
|
+
* Axes 1-3 return linear limits in Defold units. Axes 4-6 return angular
|
|
545
|
+
* limits in radians.
|
|
546
|
+
*
|
|
547
|
+
* @param constraint - 6-DOF-derived constraint
|
|
548
|
+
* @param axis - one-based axis from 1 to 6. **⚠️ 1-based; passed to Defold unchanged.**
|
|
549
|
+
*/
|
|
550
|
+
function get_limit(constraint: bullet3d.constraint.btTypedConstraint, axis: number): LuaMultiReturn<[number, number]>;
|
|
551
|
+
/**
|
|
552
|
+
* Get point-to-point pivots
|
|
553
|
+
*
|
|
554
|
+
* @param constraint - point-to-point constraint
|
|
555
|
+
*/
|
|
556
|
+
function get_pivots(constraint: bullet3d.constraint.btTypedConstraint): LuaMultiReturn<[Vector3, Vector3]>;
|
|
557
|
+
/**
|
|
558
|
+
* Get slider limits
|
|
559
|
+
*
|
|
560
|
+
* @param constraint - slider constraint
|
|
561
|
+
*/
|
|
562
|
+
function get_slider_limits(constraint: bullet3d.constraint.btTypedConstraint): LuaMultiReturn<[number, number, number, number]>;
|
|
563
|
+
/**
|
|
564
|
+
* The linear motor uses Defold units per second and maximum force. The angular
|
|
565
|
+
* motor uses radians per second and maximum torque in Defold squared units.
|
|
566
|
+
*
|
|
567
|
+
* @param constraint - slider constraint
|
|
568
|
+
* @param motor - `linear` or `angular`
|
|
569
|
+
*/
|
|
570
|
+
function get_slider_motor(constraint: bullet3d.constraint.btTypedConstraint, motor: string): LuaMultiReturn<[boolean, number, number]>;
|
|
571
|
+
/**
|
|
572
|
+
* Get the current slider position
|
|
573
|
+
*
|
|
574
|
+
* @param constraint - slider constraint
|
|
575
|
+
* @returns current linear position in Defold units
|
|
576
|
+
*/
|
|
577
|
+
function get_slider_position(constraint: bullet3d.constraint.btTypedConstraint): number;
|
|
578
|
+
/**
|
|
579
|
+
* Get the current cone-twist twist angle
|
|
580
|
+
*
|
|
581
|
+
* @param constraint - cone-twist constraint
|
|
582
|
+
* @returns twist angle in radians
|
|
583
|
+
*/
|
|
584
|
+
function get_twist_angle(constraint: bullet3d.constraint.btTypedConstraint): number;
|
|
585
|
+
/**
|
|
586
|
+
* Get the constraint type
|
|
587
|
+
*
|
|
588
|
+
* @param constraint - constraint
|
|
589
|
+
* @returns constraint type
|
|
590
|
+
*/
|
|
591
|
+
function get_type(constraint: bullet3d.constraint.btTypedConstraint): bullet3d.constraint.CONSTRAINT_TYPE;
|
|
592
|
+
/**
|
|
593
|
+
* Returns a stable lowercase diagnostic name such as `"hinge"` or
|
|
594
|
+
* `"generic_6dof_spring"`.
|
|
595
|
+
*
|
|
596
|
+
* @param constraint - constraint
|
|
597
|
+
* @returns constraint type name
|
|
598
|
+
*/
|
|
599
|
+
function get_type_name(constraint: bullet3d.constraint.btTypedConstraint): string;
|
|
600
|
+
/**
|
|
601
|
+
* Get the slider linear reference-frame choice
|
|
602
|
+
*
|
|
603
|
+
* @param constraint - slider constraint
|
|
604
|
+
* @returns true when linear calculations reference frame A
|
|
605
|
+
*/
|
|
606
|
+
function get_use_linear_reference_frame_a(constraint: bullet3d.constraint.btTypedConstraint): boolean;
|
|
607
|
+
/**
|
|
608
|
+
* Get the owning world
|
|
609
|
+
*
|
|
610
|
+
* @param constraint - constraint
|
|
611
|
+
* @returns owning world
|
|
612
|
+
*/
|
|
613
|
+
function get_world(constraint: bullet3d.constraint.btTypedConstraint): bullet3d.btDiscreteDynamicsWorld;
|
|
614
|
+
/**
|
|
615
|
+
* Test whether a constraint is active in its world
|
|
616
|
+
*
|
|
617
|
+
* @param constraint - constraint
|
|
618
|
+
* @returns false while a linked body is disabled
|
|
619
|
+
*/
|
|
620
|
+
function is_active(constraint: bullet3d.constraint.btTypedConstraint): boolean;
|
|
621
|
+
/**
|
|
622
|
+
* Test angular-only mode
|
|
623
|
+
*
|
|
624
|
+
* @param constraint - hinge or cone-twist constraint
|
|
625
|
+
* @returns angular-only state
|
|
626
|
+
*/
|
|
627
|
+
function is_angular_only(constraint: bullet3d.constraint.btTypedConstraint): boolean;
|
|
628
|
+
/**
|
|
629
|
+
* Both a ranged and a locked axis are considered limited; a free axis is not.
|
|
630
|
+
*
|
|
631
|
+
* @param constraint - 6-DOF-derived constraint
|
|
632
|
+
* @param axis - one-based axis from 1 to 6. **⚠️ 1-based; passed to Defold unchanged.**
|
|
633
|
+
* @returns limit state
|
|
634
|
+
*/
|
|
635
|
+
function is_limited(constraint: bullet3d.constraint.btTypedConstraint, axis: number): boolean;
|
|
636
|
+
/**
|
|
637
|
+
* Test whether a cone-twist is past its swing limit
|
|
638
|
+
*
|
|
639
|
+
* @param constraint - cone-twist constraint
|
|
640
|
+
* @returns swing-limit state
|
|
641
|
+
*/
|
|
642
|
+
function is_past_swing_limit(constraint: bullet3d.constraint.btTypedConstraint): boolean;
|
|
643
|
+
/**
|
|
644
|
+
* Test whether a constraint handle is valid
|
|
645
|
+
*
|
|
646
|
+
* @param constraint - constraint handle
|
|
647
|
+
* @returns true while the native constraint exists
|
|
648
|
+
*/
|
|
649
|
+
function is_valid(constraint: bullet3d.constraint.btTypedConstraint): boolean;
|
|
650
|
+
/**
|
|
651
|
+
* Linear and angular values use the units described by `get_6dof_motor`.
|
|
652
|
+
*
|
|
653
|
+
* @param constraint - 6-DOF-derived constraint
|
|
654
|
+
* @param axis - one-based axis from 1 to 6. **⚠️ 1-based; passed to Defold unchanged.**
|
|
655
|
+
* @param enabled - motor state
|
|
656
|
+
* @param target_velocity - linear or angular target velocity
|
|
657
|
+
* @param max_force - non-negative maximum motor force for linear axes or torque for angular axes
|
|
658
|
+
* @param bounce - optional bounce from 0 to 1; defaults to `0`
|
|
659
|
+
*/
|
|
660
|
+
function set_6dof_motor(constraint: bullet3d.constraint.btTypedConstraint, axis: number, enabled: boolean, target_velocity: number, max_force: number, bounce?: number): void;
|
|
661
|
+
/**
|
|
662
|
+
* Set angular-only mode
|
|
663
|
+
*
|
|
664
|
+
* @param constraint - hinge or cone-twist constraint
|
|
665
|
+
* @param angular_only - angular-only state
|
|
666
|
+
*/
|
|
667
|
+
function set_angular_only(constraint: bullet3d.constraint.btTypedConstraint, angular_only: boolean): void;
|
|
668
|
+
/**
|
|
669
|
+
* Set cone-twist angular spans
|
|
670
|
+
*
|
|
671
|
+
* @param constraint - cone-twist constraint
|
|
672
|
+
* @param swing_span_1 - non-negative first swing span in radians
|
|
673
|
+
* @param swing_span_2 - non-negative second swing span in radians
|
|
674
|
+
* @param twist_span - non-negative twist span in radians
|
|
675
|
+
* @param softness - optional softness from 0 to 1; defaults to `1`
|
|
676
|
+
* @param bias - optional bias from 0 to 1; defaults to `0.3`
|
|
677
|
+
* @param relaxation - optional relaxation from 0 to 1; defaults to `1`
|
|
678
|
+
*/
|
|
679
|
+
function set_cone_twist_limits(constraint: bullet3d.constraint.btTypedConstraint, swing_span_1: number, swing_span_2: number, twist_span: number, softness?: number, bias?: number, relaxation?: number): void;
|
|
680
|
+
/**
|
|
681
|
+
* By default, `target` is the desired rotation of body A relative to body B.
|
|
682
|
+
* With `constraint_space` set, it is the desired rotation of frame A relative
|
|
683
|
+
* to frame B in constraint space.
|
|
684
|
+
*
|
|
685
|
+
* @param constraint - cone-twist constraint
|
|
686
|
+
* @param target - finite, non-zero target orientation; normalized by the binding
|
|
687
|
+
* @param constraint_space - optional target-is-in-constraint-space flag; defaults to `false`
|
|
688
|
+
*/
|
|
689
|
+
function set_cone_twist_motor_target(constraint: bullet3d.constraint.btTypedConstraint, target: Quaternion, constraint_space?: boolean): void;
|
|
690
|
+
/**
|
|
691
|
+
* Frame mutation is supported for hinge, generic 6-DOF, generic spring 6-DOF,
|
|
692
|
+
* and slider constraints. Cone-twist, universal, and hinge2 frames are
|
|
693
|
+
* read-only through this API.
|
|
694
|
+
*
|
|
695
|
+
* @param constraint - mutable framed constraint
|
|
696
|
+
* @param position - finite local position
|
|
697
|
+
* @param rotation - finite, non-zero local rotation; normalized by the binding
|
|
698
|
+
*/
|
|
699
|
+
function set_frame_a(constraint: bullet3d.constraint.btTypedConstraint, position: Vector3, rotation: Quaternion): void;
|
|
700
|
+
/**
|
|
701
|
+
* Supports the same constraint types as `set_frame_a`. For a one-body
|
|
702
|
+
* constraint, this changes the frame attached to the fixed world body.
|
|
703
|
+
*
|
|
704
|
+
* @param constraint - mutable framed constraint
|
|
705
|
+
* @param position - finite local position or world frame position
|
|
706
|
+
* @param rotation - finite, non-zero local or world frame rotation; normalized by the binding
|
|
707
|
+
*/
|
|
708
|
+
function set_frame_b(constraint: bullet3d.constraint.btTypedConstraint, position: Vector3, rotation: Quaternion): void;
|
|
709
|
+
/**
|
|
710
|
+
* This function only supports hinges attached to the world. For a two-body
|
|
711
|
+
* hinge, change both local frames with `set_frame_a` and `set_frame_b`.
|
|
712
|
+
*
|
|
713
|
+
* @param constraint - one-body hinge constraint
|
|
714
|
+
* @param axis - non-zero axis in body-A space
|
|
715
|
+
*/
|
|
716
|
+
function set_hinge_axis(constraint: bullet3d.constraint.btTypedConstraint, axis: Vector3): void;
|
|
717
|
+
/**
|
|
718
|
+
* Set hinge angular limits
|
|
719
|
+
*
|
|
720
|
+
* @param constraint - hinge constraint
|
|
721
|
+
* @param lower - lower angle in radians
|
|
722
|
+
* @param upper - upper angle in radians
|
|
723
|
+
* @param bias - optional limit bias from 0 to 1; defaults to `0.3`
|
|
724
|
+
* @param relaxation - optional relaxation from 0 to 1; defaults to `1`
|
|
725
|
+
*/
|
|
726
|
+
function set_hinge_limits(constraint: bullet3d.constraint.btTypedConstraint, lower: number, upper: number, bias?: number, relaxation?: number): void;
|
|
727
|
+
/**
|
|
728
|
+
* Set hinge motor settings
|
|
729
|
+
*
|
|
730
|
+
* @param constraint - hinge constraint
|
|
731
|
+
* @param enabled - motor state
|
|
732
|
+
* @param target_velocity - angular target velocity in radians per second
|
|
733
|
+
* @param max_impulse - non-negative maximum angular motor impulse in Defold squared units
|
|
734
|
+
*/
|
|
735
|
+
function set_hinge_motor(constraint: bullet3d.constraint.btTypedConstraint, enabled: boolean, target_velocity: number, max_impulse: number): void;
|
|
736
|
+
/**
|
|
737
|
+
* Set a hinge motor angle target
|
|
738
|
+
*
|
|
739
|
+
* @param constraint - hinge constraint
|
|
740
|
+
* @param target_angle - target angle in radians
|
|
741
|
+
* @param time_step - positive step duration in seconds
|
|
742
|
+
*/
|
|
743
|
+
function set_hinge_motor_target(constraint: bullet3d.constraint.btTypedConstraint, target_angle: number, time_step: number): void;
|
|
744
|
+
/**
|
|
745
|
+
* Axes 1-3 use Defold units and axes 4-6 use radians. A lower value less than
|
|
746
|
+
* the upper value creates a limited range, equal values lock the axis, and a
|
|
747
|
+
* lower value greater than the upper value makes the axis free.
|
|
748
|
+
*
|
|
749
|
+
* @param constraint - 6-DOF-derived constraint
|
|
750
|
+
* @param axis - one-based axis from 1 to 6. **⚠️ 1-based; passed to Defold unchanged.**
|
|
751
|
+
* @param lower - lower limit
|
|
752
|
+
* @param upper - upper limit
|
|
753
|
+
*/
|
|
754
|
+
function set_limit(constraint: bullet3d.constraint.btTypedConstraint, axis: number, lower: number, upper: number): void;
|
|
755
|
+
/**
|
|
756
|
+
* Set point-to-point pivots
|
|
757
|
+
*
|
|
758
|
+
* @param constraint - point-to-point constraint
|
|
759
|
+
* @param pivot_a - local body-A pivot
|
|
760
|
+
* @param pivot_b - local body-B pivot or world anchor
|
|
761
|
+
*/
|
|
762
|
+
function set_pivots(constraint: bullet3d.constraint.btTypedConstraint, pivot_a: Vector3, pivot_b: Vector3): void;
|
|
763
|
+
/**
|
|
764
|
+
* Each lower/upper pair follows Bullet's limit convention: lower less than
|
|
765
|
+
* upper creates a limited range, equal values lock that axis, and lower greater
|
|
766
|
+
* than upper makes it free. Bullet normalizes the angular limits.
|
|
767
|
+
*
|
|
768
|
+
* @param constraint - slider constraint
|
|
769
|
+
* @param lower_linear - lower linear limit in Defold units
|
|
770
|
+
* @param upper_linear - upper linear limit in Defold units
|
|
771
|
+
* @param lower_angular - lower angular limit in radians
|
|
772
|
+
* @param upper_angular - upper angular limit in radians
|
|
773
|
+
*/
|
|
774
|
+
function set_slider_limits(constraint: bullet3d.constraint.btTypedConstraint, lower_linear: number, upper_linear: number, lower_angular: number, upper_angular: number): void;
|
|
775
|
+
/**
|
|
776
|
+
* Linear and angular values use the units described by `get_slider_motor`.
|
|
777
|
+
*
|
|
778
|
+
* @param constraint - slider constraint
|
|
779
|
+
* @param motor - `linear` or `angular`
|
|
780
|
+
* @param enabled - motor state
|
|
781
|
+
* @param target_velocity - linear or angular target velocity
|
|
782
|
+
* @param max_force - non-negative maximum linear force or angular torque
|
|
783
|
+
*/
|
|
784
|
+
function set_slider_motor(constraint: bullet3d.constraint.btTypedConstraint, motor: string, enabled: boolean, target_velocity: number, max_force: number): void;
|
|
785
|
+
/**
|
|
786
|
+
* Generic spring 6-DOF constraints use a scale-independent damping factor from
|
|
787
|
+
* 0 to 1, where 1 means no damping. Hinge2 constraints use a damping coefficient
|
|
788
|
+
* where 0 means no damping and any non-negative value is accepted. Hinge2
|
|
789
|
+
* angular damping is automatically converted using `physics.scale` squared.
|
|
790
|
+
*
|
|
791
|
+
* @param constraint - spring 6-DOF or hinge2 constraint
|
|
792
|
+
* @param axis - one-based axis from 1 to 6. **⚠️ 1-based; passed to Defold unchanged.**
|
|
793
|
+
* @param damping - damping value in the range required by the constraint type
|
|
794
|
+
*/
|
|
795
|
+
function set_spring_damping(constraint: bullet3d.constraint.btTypedConstraint, axis: number, damping: number): void;
|
|
796
|
+
/**
|
|
797
|
+
* With no axis, captures all current transforms. With an axis and no value,
|
|
798
|
+
* captures that axis. Linear values use Defold units and angular values use
|
|
799
|
+
* radians.
|
|
800
|
+
*
|
|
801
|
+
* @param constraint - spring 6-DOF or hinge2 constraint
|
|
802
|
+
* @param axis - optional one-based axis from 1 to 6. **⚠️ 1-based; passed to Defold unchanged.**
|
|
803
|
+
* @param value - optional explicit equilibrium value
|
|
804
|
+
*/
|
|
805
|
+
function set_spring_equilibrium_point(constraint: bullet3d.constraint.btTypedConstraint, axis?: number, value?: number): void;
|
|
806
|
+
/**
|
|
807
|
+
* Linear stiffness values are independent of `physics.scale`. Angular
|
|
808
|
+
* stiffness values are automatically converted using `physics.scale` squared.
|
|
809
|
+
*
|
|
810
|
+
* @param constraint - spring 6-DOF or hinge2 constraint
|
|
811
|
+
* @param axis - one-based axis from 1 to 6. **⚠️ 1-based; passed to Defold unchanged.**
|
|
812
|
+
* @param stiffness - non-negative stiffness
|
|
813
|
+
*/
|
|
814
|
+
function set_spring_stiffness(constraint: bullet3d.constraint.btTypedConstraint, axis: number, stiffness: number): void;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
export {};
|