@gg-web-engine/rapier3d 0.0.24
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/README.md +17 -0
- package/dist/components/rapier-3d-rigid-body.component.d.ts +26 -0
- package/dist/components/rapier-3d-rigid-body.component.js +88 -0
- package/dist/components/rapier-3d-trigger.component.d.ts +17 -0
- package/dist/components/rapier-3d-trigger.component.js +41 -0
- package/dist/components/rapier-3d-world.component.d.ts +27 -0
- package/dist/components/rapier-3d-world.component.js +81 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -0
- package/dist/rapier-3d-factory.d.ts +22 -0
- package/dist/rapier-3d-factory.js +89 -0
- package/dist/rapier-3d-loader.d.ts +6 -0
- package/dist/rapier-3d-loader.js +7 -0
- package/etc/@dimforge/rapier3d/LICENSE +201 -0
- package/etc/@dimforge/rapier3d/README.md +33 -0
- package/etc/@dimforge/rapier3d/coarena.d.ts +15 -0
- package/etc/@dimforge/rapier3d/coarena.js +61 -0
- package/etc/@dimforge/rapier3d/coarena.js.map +1 -0
- package/etc/@dimforge/rapier3d/control/character_controller.d.ts +188 -0
- package/etc/@dimforge/rapier3d/control/character_controller.js +256 -0
- package/etc/@dimforge/rapier3d/control/character_controller.js.map +1 -0
- package/etc/@dimforge/rapier3d/control/index.d.ts +2 -0
- package/etc/@dimforge/rapier3d/control/index.js +5 -0
- package/etc/@dimforge/rapier3d/control/index.js.map +1 -0
- package/etc/@dimforge/rapier3d/control/ray_cast_vehicle_controller.d.ts +240 -0
- package/etc/@dimforge/rapier3d/control/ray_cast_vehicle_controller.js +362 -0
- package/etc/@dimforge/rapier3d/control/ray_cast_vehicle_controller.js.map +1 -0
- package/etc/@dimforge/rapier3d/dynamics/ccd_solver.d.ts +15 -0
- package/etc/@dimforge/rapier3d/dynamics/ccd_solver.js +22 -0
- package/etc/@dimforge/rapier3d/dynamics/ccd_solver.js.map +1 -0
- package/etc/@dimforge/rapier3d/dynamics/coefficient_combine_rule.d.ts +13 -0
- package/etc/@dimforge/rapier3d/dynamics/coefficient_combine_rule.js +15 -0
- package/etc/@dimforge/rapier3d/dynamics/coefficient_combine_rule.js.map +1 -0
- package/etc/@dimforge/rapier3d/dynamics/impulse_joint.d.ts +204 -0
- package/etc/@dimforge/rapier3d/dynamics/impulse_joint.js +335 -0
- package/etc/@dimforge/rapier3d/dynamics/impulse_joint.js.map +1 -0
- package/etc/@dimforge/rapier3d/dynamics/impulse_joint_set.d.ts +79 -0
- package/etc/@dimforge/rapier3d/dynamics/impulse_joint_set.js +123 -0
- package/etc/@dimforge/rapier3d/dynamics/impulse_joint_set.js.map +1 -0
- package/etc/@dimforge/rapier3d/dynamics/index.d.ts +10 -0
- package/etc/@dimforge/rapier3d/dynamics/index.js +11 -0
- package/etc/@dimforge/rapier3d/dynamics/index.js.map +1 -0
- package/etc/@dimforge/rapier3d/dynamics/integration_parameters.d.ts +55 -0
- package/etc/@dimforge/rapier3d/dynamics/integration_parameters.js +98 -0
- package/etc/@dimforge/rapier3d/dynamics/integration_parameters.js.map +1 -0
- package/etc/@dimforge/rapier3d/dynamics/island_manager.d.ts +24 -0
- package/etc/@dimforge/rapier3d/dynamics/island_manager.js +32 -0
- package/etc/@dimforge/rapier3d/dynamics/island_manager.js.map +1 -0
- package/etc/@dimforge/rapier3d/dynamics/multibody_joint.d.ts +42 -0
- package/etc/@dimforge/rapier3d/dynamics/multibody_joint.js +124 -0
- package/etc/@dimforge/rapier3d/dynamics/multibody_joint.js.map +1 -0
- package/etc/@dimforge/rapier3d/dynamics/multibody_joint_set.d.ts +76 -0
- package/etc/@dimforge/rapier3d/dynamics/multibody_joint_set.js +118 -0
- package/etc/@dimforge/rapier3d/dynamics/multibody_joint_set.js.map +1 -0
- package/etc/@dimforge/rapier3d/dynamics/rigid_body.d.ts +679 -0
- package/etc/@dimforge/rapier3d/dynamics/rigid_body.js +960 -0
- package/etc/@dimforge/rapier3d/dynamics/rigid_body.js.map +1 -0
- package/etc/@dimforge/rapier3d/dynamics/rigid_body_set.d.ts +78 -0
- package/etc/@dimforge/rapier3d/dynamics/rigid_body_set.js +147 -0
- package/etc/@dimforge/rapier3d/dynamics/rigid_body_set.js.map +1 -0
- package/etc/@dimforge/rapier3d/exports.d.ts +7 -0
- package/etc/@dimforge/rapier3d/exports.js +11 -0
- package/etc/@dimforge/rapier3d/exports.js.map +1 -0
- package/etc/@dimforge/rapier3d/geometry/broad_phase.d.ts +15 -0
- package/etc/@dimforge/rapier3d/geometry/broad_phase.js +22 -0
- package/etc/@dimforge/rapier3d/geometry/broad_phase.js.map +1 -0
- package/etc/@dimforge/rapier3d/geometry/collider.d.ts +763 -0
- package/etc/@dimforge/rapier3d/geometry/collider.js +1140 -0
- package/etc/@dimforge/rapier3d/geometry/collider.js.map +1 -0
- package/etc/@dimforge/rapier3d/geometry/collider_set.d.ts +72 -0
- package/etc/@dimforge/rapier3d/geometry/collider_set.js +144 -0
- package/etc/@dimforge/rapier3d/geometry/collider_set.js.map +1 -0
- package/etc/@dimforge/rapier3d/geometry/contact.d.ts +31 -0
- package/etc/@dimforge/rapier3d/geometry/contact.js +21 -0
- package/etc/@dimforge/rapier3d/geometry/contact.js.map +1 -0
- package/etc/@dimforge/rapier3d/geometry/feature.d.ts +6 -0
- package/etc/@dimforge/rapier3d/geometry/feature.js +10 -0
- package/etc/@dimforge/rapier3d/geometry/feature.js.map +1 -0
- package/etc/@dimforge/rapier3d/geometry/index.d.ts +11 -0
- package/etc/@dimforge/rapier3d/geometry/index.js +12 -0
- package/etc/@dimforge/rapier3d/geometry/index.js.map +1 -0
- package/etc/@dimforge/rapier3d/geometry/interaction_groups.d.ts +18 -0
- package/etc/@dimforge/rapier3d/geometry/interaction_groups.js +2 -0
- package/etc/@dimforge/rapier3d/geometry/interaction_groups.js.map +1 -0
- package/etc/@dimforge/rapier3d/geometry/narrow_phase.d.ts +71 -0
- package/etc/@dimforge/rapier3d/geometry/narrow_phase.js +148 -0
- package/etc/@dimforge/rapier3d/geometry/narrow_phase.js.map +1 -0
- package/etc/@dimforge/rapier3d/geometry/point.d.ts +47 -0
- package/etc/@dimforge/rapier3d/geometry/point.js +48 -0
- package/etc/@dimforge/rapier3d/geometry/point.js.map +1 -0
- package/etc/@dimforge/rapier3d/geometry/ray.d.ts +97 -0
- package/etc/@dimforge/rapier3d/geometry/ray.js +100 -0
- package/etc/@dimforge/rapier3d/geometry/ray.js.map +1 -0
- package/etc/@dimforge/rapier3d/geometry/shape.d.ts +489 -0
- package/etc/@dimforge/rapier3d/geometry/shape.js +686 -0
- package/etc/@dimforge/rapier3d/geometry/shape.js.map +1 -0
- package/etc/@dimforge/rapier3d/geometry/toi.d.ts +46 -0
- package/etc/@dimforge/rapier3d/geometry/toi.js +37 -0
- package/etc/@dimforge/rapier3d/geometry/toi.js.map +1 -0
- package/etc/@dimforge/rapier3d/init.d.ts +1 -0
- package/etc/@dimforge/rapier3d/init.js +2 -0
- package/etc/@dimforge/rapier3d/init.js.map +1 -0
- package/etc/@dimforge/rapier3d/math.d.ts +94 -0
- package/etc/@dimforge/rapier3d/math.js +138 -0
- package/etc/@dimforge/rapier3d/math.js.map +1 -0
- package/etc/@dimforge/rapier3d/package.json +33 -0
- package/etc/@dimforge/rapier3d/pipeline/debug_render_pipeline.d.ts +39 -0
- package/etc/@dimforge/rapier3d/pipeline/debug_render_pipeline.js +38 -0
- package/etc/@dimforge/rapier3d/pipeline/debug_render_pipeline.js.map +1 -0
- package/etc/@dimforge/rapier3d/pipeline/event_queue.d.ts +101 -0
- package/etc/@dimforge/rapier3d/pipeline/event_queue.js +135 -0
- package/etc/@dimforge/rapier3d/pipeline/event_queue.js.map +1 -0
- package/etc/@dimforge/rapier3d/pipeline/index.d.ts +7 -0
- package/etc/@dimforge/rapier3d/pipeline/index.js +8 -0
- package/etc/@dimforge/rapier3d/pipeline/index.js.map +1 -0
- package/etc/@dimforge/rapier3d/pipeline/physics_hooks.d.ts +39 -0
- package/etc/@dimforge/rapier3d/pipeline/physics_hooks.js +13 -0
- package/etc/@dimforge/rapier3d/pipeline/physics_hooks.js.map +1 -0
- package/etc/@dimforge/rapier3d/pipeline/physics_pipeline.d.ts +12 -0
- package/etc/@dimforge/rapier3d/pipeline/physics_pipeline.js +24 -0
- package/etc/@dimforge/rapier3d/pipeline/physics_pipeline.js.map +1 -0
- package/etc/@dimforge/rapier3d/pipeline/query_pipeline.d.ts +190 -0
- package/etc/@dimforge/rapier3d/pipeline/query_pipeline.js +271 -0
- package/etc/@dimforge/rapier3d/pipeline/query_pipeline.js.map +1 -0
- package/etc/@dimforge/rapier3d/pipeline/serialization_pipeline.d.ts +37 -0
- package/etc/@dimforge/rapier3d/pipeline/serialization_pipeline.js +49 -0
- package/etc/@dimforge/rapier3d/pipeline/serialization_pipeline.js.map +1 -0
- package/etc/@dimforge/rapier3d/pipeline/world.d.ts +419 -0
- package/etc/@dimforge/rapier3d/pipeline/world.js +581 -0
- package/etc/@dimforge/rapier3d/pipeline/world.js.map +1 -0
- package/etc/@dimforge/rapier3d/rapier.d.ts +3 -0
- package/etc/@dimforge/rapier3d/rapier.js +4 -0
- package/etc/@dimforge/rapier3d/rapier.js.map +1 -0
- package/etc/@dimforge/rapier3d/rapier_wasm3d.d.ts +2921 -0
- package/etc/@dimforge/rapier3d/rapier_wasm3d.js +2 -0
- package/etc/@dimforge/rapier3d/rapier_wasm3d_bg.js +5585 -0
- package/etc/@dimforge/rapier3d/rapier_wasm3d_bg.wasm +0 -0
- package/etc/@dimforge/rapier3d/rapier_wasm3d_bg.wasm.d.ts +486 -0
- package/etc/@dimforge/rapier3d/raw.d.ts +1 -0
- package/etc/@dimforge/rapier3d/raw.js +2 -0
- package/etc/@dimforge/rapier3d/raw.js.map +1 -0
- package/package.json +43 -0
- package/tsconfig.json +8 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { RawImpulseJointSet } from "../raw";
|
|
2
|
+
import { Coarena } from "../coarena";
|
|
3
|
+
import { ImpulseJoint,
|
|
4
|
+
// #endif
|
|
5
|
+
} from "./impulse_joint";
|
|
6
|
+
/**
|
|
7
|
+
* A set of joints.
|
|
8
|
+
*
|
|
9
|
+
* To avoid leaking WASM resources, this MUST be freed manually with `jointSet.free()`
|
|
10
|
+
* once you are done using it (and all the joints it created).
|
|
11
|
+
*/
|
|
12
|
+
export class ImpulseJointSet {
|
|
13
|
+
/**
|
|
14
|
+
* Release the WASM memory occupied by this joint set.
|
|
15
|
+
*/
|
|
16
|
+
free() {
|
|
17
|
+
if (!!this.raw) {
|
|
18
|
+
this.raw.free();
|
|
19
|
+
}
|
|
20
|
+
this.raw = undefined;
|
|
21
|
+
if (!!this.map) {
|
|
22
|
+
this.map.clear();
|
|
23
|
+
}
|
|
24
|
+
this.map = undefined;
|
|
25
|
+
}
|
|
26
|
+
constructor(raw) {
|
|
27
|
+
this.raw = raw || new RawImpulseJointSet();
|
|
28
|
+
this.map = new Coarena();
|
|
29
|
+
// Initialize the map with the existing elements, if any.
|
|
30
|
+
if (raw) {
|
|
31
|
+
raw.forEachJointHandle((handle) => {
|
|
32
|
+
this.map.set(handle, ImpulseJoint.newTyped(raw, null, handle));
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** @internal */
|
|
37
|
+
finalizeDeserialization(bodies) {
|
|
38
|
+
this.map.forEach((joint) => joint.finalizeDeserialization(bodies));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new joint and return its integer handle.
|
|
42
|
+
*
|
|
43
|
+
* @param bodies - The set of rigid-bodies containing the bodies the joint is attached to.
|
|
44
|
+
* @param desc - The joint's parameters.
|
|
45
|
+
* @param parent1 - The handle of the first rigid-body this joint is attached to.
|
|
46
|
+
* @param parent2 - The handle of the second rigid-body this joint is attached to.
|
|
47
|
+
* @param wakeUp - Should the attached rigid-bodies be awakened?
|
|
48
|
+
*/
|
|
49
|
+
createJoint(bodies, desc, parent1, parent2, wakeUp) {
|
|
50
|
+
const rawParams = desc.intoRaw();
|
|
51
|
+
const handle = this.raw.createJoint(rawParams, parent1, parent2, wakeUp);
|
|
52
|
+
rawParams.free();
|
|
53
|
+
let joint = ImpulseJoint.newTyped(this.raw, bodies, handle);
|
|
54
|
+
this.map.set(handle, joint);
|
|
55
|
+
return joint;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Remove a joint from this set.
|
|
59
|
+
*
|
|
60
|
+
* @param handle - The integer handle of the joint.
|
|
61
|
+
* @param wakeUp - If `true`, the rigid-bodies attached by the removed joint will be woken-up automatically.
|
|
62
|
+
*/
|
|
63
|
+
remove(handle, wakeUp) {
|
|
64
|
+
this.raw.remove(handle, wakeUp);
|
|
65
|
+
this.unmap(handle);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Calls the given closure with the integer handle of each impulse joint attached to this rigid-body.
|
|
69
|
+
*
|
|
70
|
+
* @param f - The closure called with the integer handle of each impulse joint attached to the rigid-body.
|
|
71
|
+
*/
|
|
72
|
+
forEachJointHandleAttachedToRigidBody(handle, f) {
|
|
73
|
+
this.raw.forEachJointAttachedToRigidBody(handle, f);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Internal function, do not call directly.
|
|
77
|
+
* @param handle
|
|
78
|
+
*/
|
|
79
|
+
unmap(handle) {
|
|
80
|
+
this.map.delete(handle);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The number of joints on this set.
|
|
84
|
+
*/
|
|
85
|
+
len() {
|
|
86
|
+
return this.map.len();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Does this set contain a joint with the given handle?
|
|
90
|
+
*
|
|
91
|
+
* @param handle - The joint handle to check.
|
|
92
|
+
*/
|
|
93
|
+
contains(handle) {
|
|
94
|
+
return this.get(handle) != null;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Gets the joint with the given handle.
|
|
98
|
+
*
|
|
99
|
+
* Returns `null` if no joint with the specified handle exists.
|
|
100
|
+
*
|
|
101
|
+
* @param handle - The integer handle of the joint to retrieve.
|
|
102
|
+
*/
|
|
103
|
+
get(handle) {
|
|
104
|
+
return this.map.get(handle);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Applies the given closure to each joint contained by this set.
|
|
108
|
+
*
|
|
109
|
+
* @param f - The closure to apply.
|
|
110
|
+
*/
|
|
111
|
+
forEach(f) {
|
|
112
|
+
this.map.forEach(f);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Gets all joints in the list.
|
|
116
|
+
*
|
|
117
|
+
* @returns joint list.
|
|
118
|
+
*/
|
|
119
|
+
getAll() {
|
|
120
|
+
return this.map.getAll();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=impulse_joint_set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impulse_joint_set.js","sourceRoot":"","sources":["../src/dynamics/impulse_joint_set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AAEnC,OAAO,EAGH,YAAY;AAOZ,SAAS;EACZ,MAAM,iBAAiB,CAAC;AAKzB;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAIxB;;OAEG;IACI,IAAI;QACP,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACnB;QACD,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC;QAErB,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;SACpB;QACD,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC;IACzB,CAAC;IAED,YAAY,GAAwB;QAChC,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,IAAI,kBAAkB,EAAE,CAAC;QAC3C,IAAI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C,IAAI,CAAC,GAAG,CAAC,+BAA+B,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACxD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,MAA0B;QACnC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,GAAG;QACN,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,MAA0B;QACtC,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;IACpC,CAAC;IAED;;;;;;OAMG;IACI,GAAG,CAAC,MAA0B;QACjC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,CAAgC;QAC3C,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,MAAM;QACT,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IAC7B,CAAC;CACJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./rigid_body";
|
|
2
|
+
export * from "./rigid_body_set";
|
|
3
|
+
export * from "./integration_parameters";
|
|
4
|
+
export * from "./impulse_joint";
|
|
5
|
+
export * from "./impulse_joint_set";
|
|
6
|
+
export * from "./multibody_joint";
|
|
7
|
+
export * from "./multibody_joint_set";
|
|
8
|
+
export * from "./coefficient_combine_rule";
|
|
9
|
+
export * from "./ccd_solver";
|
|
10
|
+
export * from "./island_manager";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./rigid_body";
|
|
2
|
+
export * from "./rigid_body_set";
|
|
3
|
+
export * from "./integration_parameters";
|
|
4
|
+
export * from "./impulse_joint";
|
|
5
|
+
export * from "./impulse_joint_set";
|
|
6
|
+
export * from "./multibody_joint";
|
|
7
|
+
export * from "./multibody_joint_set";
|
|
8
|
+
export * from "./coefficient_combine_rule";
|
|
9
|
+
export * from "./ccd_solver";
|
|
10
|
+
export * from "./island_manager";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/dynamics/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { RawIntegrationParameters } from "../raw";
|
|
2
|
+
export declare class IntegrationParameters {
|
|
3
|
+
raw: RawIntegrationParameters;
|
|
4
|
+
constructor(raw?: RawIntegrationParameters);
|
|
5
|
+
/**
|
|
6
|
+
* Free the WASM memory used by these integration parameters.
|
|
7
|
+
*/
|
|
8
|
+
free(): void;
|
|
9
|
+
/**
|
|
10
|
+
* The timestep length (default: `1.0 / 60.0`)
|
|
11
|
+
*/
|
|
12
|
+
get dt(): number;
|
|
13
|
+
/**
|
|
14
|
+
* The Error Reduction Parameter in `[0, 1]` is the proportion of
|
|
15
|
+
* the positional error to be corrected at each time step (default: `0.2`).
|
|
16
|
+
*/
|
|
17
|
+
get erp(): number;
|
|
18
|
+
/**
|
|
19
|
+
* Amount of penetration the engine wont attempt to correct (default: `0.001m`).
|
|
20
|
+
*/
|
|
21
|
+
get allowedLinearError(): number;
|
|
22
|
+
/**
|
|
23
|
+
* The maximal distance separating two objects that will generate predictive contacts (default: `0.002`).
|
|
24
|
+
*/
|
|
25
|
+
get predictionDistance(): number;
|
|
26
|
+
/**
|
|
27
|
+
* Maximum number of iterations performed by the velocity constraints solver (default: `4`).
|
|
28
|
+
*/
|
|
29
|
+
get maxVelocityIterations(): number;
|
|
30
|
+
/**
|
|
31
|
+
* Maximum number of friction iterations performed by the position-based constraints solver (default: `1`).
|
|
32
|
+
*/
|
|
33
|
+
get maxVelocityFrictionIterations(): number;
|
|
34
|
+
/**
|
|
35
|
+
* Maximum number of stabilization iterations performed by the position-based constraints solver (default: `1`).
|
|
36
|
+
*/
|
|
37
|
+
get maxStabilizationIterations(): number;
|
|
38
|
+
/**
|
|
39
|
+
* Minimum number of dynamic bodies in each active island (default: `128`).
|
|
40
|
+
*/
|
|
41
|
+
get minIslandSize(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Maximum number of substeps performed by the solver (default: `1`).
|
|
44
|
+
*/
|
|
45
|
+
get maxCcdSubsteps(): number;
|
|
46
|
+
set dt(value: number);
|
|
47
|
+
set erp(value: number);
|
|
48
|
+
set allowedLinearError(value: number);
|
|
49
|
+
set predictionDistance(value: number);
|
|
50
|
+
set maxVelocityIterations(value: number);
|
|
51
|
+
set maxVelocityFrictionIterations(value: number);
|
|
52
|
+
set maxStabilizationIterations(value: number);
|
|
53
|
+
set minIslandSize(value: number);
|
|
54
|
+
set maxCcdSubsteps(value: number);
|
|
55
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { RawIntegrationParameters } from "../raw";
|
|
2
|
+
export class IntegrationParameters {
|
|
3
|
+
constructor(raw) {
|
|
4
|
+
this.raw = raw || new RawIntegrationParameters();
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Free the WASM memory used by these integration parameters.
|
|
8
|
+
*/
|
|
9
|
+
free() {
|
|
10
|
+
if (!!this.raw) {
|
|
11
|
+
this.raw.free();
|
|
12
|
+
}
|
|
13
|
+
this.raw = undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The timestep length (default: `1.0 / 60.0`)
|
|
17
|
+
*/
|
|
18
|
+
get dt() {
|
|
19
|
+
return this.raw.dt;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The Error Reduction Parameter in `[0, 1]` is the proportion of
|
|
23
|
+
* the positional error to be corrected at each time step (default: `0.2`).
|
|
24
|
+
*/
|
|
25
|
+
get erp() {
|
|
26
|
+
return this.raw.erp;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Amount of penetration the engine wont attempt to correct (default: `0.001m`).
|
|
30
|
+
*/
|
|
31
|
+
get allowedLinearError() {
|
|
32
|
+
return this.raw.allowedLinearError;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The maximal distance separating two objects that will generate predictive contacts (default: `0.002`).
|
|
36
|
+
*/
|
|
37
|
+
get predictionDistance() {
|
|
38
|
+
return this.raw.predictionDistance;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Maximum number of iterations performed by the velocity constraints solver (default: `4`).
|
|
42
|
+
*/
|
|
43
|
+
get maxVelocityIterations() {
|
|
44
|
+
return this.raw.maxVelocityIterations;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Maximum number of friction iterations performed by the position-based constraints solver (default: `1`).
|
|
48
|
+
*/
|
|
49
|
+
get maxVelocityFrictionIterations() {
|
|
50
|
+
return this.raw.maxVelocityFrictionIterations;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Maximum number of stabilization iterations performed by the position-based constraints solver (default: `1`).
|
|
54
|
+
*/
|
|
55
|
+
get maxStabilizationIterations() {
|
|
56
|
+
return this.raw.maxStabilizationIterations;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Minimum number of dynamic bodies in each active island (default: `128`).
|
|
60
|
+
*/
|
|
61
|
+
get minIslandSize() {
|
|
62
|
+
return this.raw.minIslandSize;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Maximum number of substeps performed by the solver (default: `1`).
|
|
66
|
+
*/
|
|
67
|
+
get maxCcdSubsteps() {
|
|
68
|
+
return this.raw.maxCcdSubsteps;
|
|
69
|
+
}
|
|
70
|
+
set dt(value) {
|
|
71
|
+
this.raw.dt = value;
|
|
72
|
+
}
|
|
73
|
+
set erp(value) {
|
|
74
|
+
this.raw.erp = value;
|
|
75
|
+
}
|
|
76
|
+
set allowedLinearError(value) {
|
|
77
|
+
this.raw.allowedLinearError = value;
|
|
78
|
+
}
|
|
79
|
+
set predictionDistance(value) {
|
|
80
|
+
this.raw.predictionDistance = value;
|
|
81
|
+
}
|
|
82
|
+
set maxVelocityIterations(value) {
|
|
83
|
+
this.raw.maxVelocityIterations = value;
|
|
84
|
+
}
|
|
85
|
+
set maxVelocityFrictionIterations(value) {
|
|
86
|
+
this.raw.maxVelocityFrictionIterations = value;
|
|
87
|
+
}
|
|
88
|
+
set maxStabilizationIterations(value) {
|
|
89
|
+
this.raw.maxStabilizationIterations = value;
|
|
90
|
+
}
|
|
91
|
+
set minIslandSize(value) {
|
|
92
|
+
this.raw.minIslandSize = value;
|
|
93
|
+
}
|
|
94
|
+
set maxCcdSubsteps(value) {
|
|
95
|
+
this.raw.maxCcdSubsteps = value;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=integration_parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration_parameters.js","sourceRoot":"","sources":["../src/dynamics/integration_parameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAC,MAAM,QAAQ,CAAC;AAEhD,MAAM,OAAO,qBAAqB;IAG9B,YAAY,GAA8B;QACtC,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,IAAI,wBAAwB,EAAE,CAAC;IACrD,CAAC;IAED;;OAEG;IACI,IAAI;QACP,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACnB;QACD,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC;IACz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AI,qBAAqB,CAAC,KAAa;QACnC,IAAI,CAAC,GAAG,CAAC,qBAAqB,GAAG,KAAK,CAAC;IAC3C,CAAC;IAED,IAAI,6BAA6B,CAAC,KAAa;QAC3C,IAAI,CAAC,GAAG,CAAC,6BAA6B,GAAG,KAAK,CAAC;IACnD,CAAC;IAED,IAAI,0BAA0B,CAAC,KAAa;QACxC,IAAI,CAAC,GAAG,CAAC,0BAA0B,GAAG,KAAK,CAAC;IAChD,CAAC;IAED,IAAI,aAAa,CAAC,KAAa;QAC3B,IAAI,CAAC,GAAG,CAAC,aAAa,GAAG,KAAK,CAAC;IACnC,CAAC;IAED,IAAI,cAAc,CAAC,KAAa;QAC5B,IAAI,CAAC,GAAG,CAAC,cAAc,GAAG,KAAK,CAAC;IACpC,CAAC;CACJ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RawIslandManager } from "../raw";
|
|
2
|
+
import { RigidBodyHandle } from "./rigid_body";
|
|
3
|
+
/**
|
|
4
|
+
* The CCD solver responsible for resolving Continuous Collision Detection.
|
|
5
|
+
*
|
|
6
|
+
* To avoid leaking WASM resources, this MUST be freed manually with `ccdSolver.free()`
|
|
7
|
+
* once you are done using it.
|
|
8
|
+
*/
|
|
9
|
+
export declare class IslandManager {
|
|
10
|
+
raw: RawIslandManager;
|
|
11
|
+
/**
|
|
12
|
+
* Release the WASM memory occupied by this narrow-phase.
|
|
13
|
+
*/
|
|
14
|
+
free(): void;
|
|
15
|
+
constructor(raw?: RawIslandManager);
|
|
16
|
+
/**
|
|
17
|
+
* Applies the given closure to the handle of each active rigid-bodies contained by this set.
|
|
18
|
+
*
|
|
19
|
+
* A rigid-body is active if it is not sleeping, i.e., if it moved recently.
|
|
20
|
+
*
|
|
21
|
+
* @param f - The closure to apply.
|
|
22
|
+
*/
|
|
23
|
+
forEachActiveRigidBodyHandle(f: (handle: RigidBodyHandle) => void): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RawIslandManager } from "../raw";
|
|
2
|
+
/**
|
|
3
|
+
* The CCD solver responsible for resolving Continuous Collision Detection.
|
|
4
|
+
*
|
|
5
|
+
* To avoid leaking WASM resources, this MUST be freed manually with `ccdSolver.free()`
|
|
6
|
+
* once you are done using it.
|
|
7
|
+
*/
|
|
8
|
+
export class IslandManager {
|
|
9
|
+
/**
|
|
10
|
+
* Release the WASM memory occupied by this narrow-phase.
|
|
11
|
+
*/
|
|
12
|
+
free() {
|
|
13
|
+
if (!!this.raw) {
|
|
14
|
+
this.raw.free();
|
|
15
|
+
}
|
|
16
|
+
this.raw = undefined;
|
|
17
|
+
}
|
|
18
|
+
constructor(raw) {
|
|
19
|
+
this.raw = raw || new RawIslandManager();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Applies the given closure to the handle of each active rigid-bodies contained by this set.
|
|
23
|
+
*
|
|
24
|
+
* A rigid-body is active if it is not sleeping, i.e., if it moved recently.
|
|
25
|
+
*
|
|
26
|
+
* @param f - The closure to apply.
|
|
27
|
+
*/
|
|
28
|
+
forEachActiveRigidBodyHandle(f) {
|
|
29
|
+
this.raw.forEachActiveRigidBodyHandle(f);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=island_manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"island_manager.js","sourceRoot":"","sources":["../src/dynamics/island_manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAGxC;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IAGtB;;OAEG;IACI,IAAI;QACP,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACnB;QACD,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC;IACzB,CAAC;IAED,YAAY,GAAsB;QAC9B,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,IAAI,gBAAgB,EAAE,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACI,4BAA4B,CAAC,CAAoC;QACpE,IAAI,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;CACJ"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RawJointAxis, RawMultibodyJointSet } from "../raw";
|
|
2
|
+
/**
|
|
3
|
+
* The integer identifier of a collider added to a `ColliderSet`.
|
|
4
|
+
*/
|
|
5
|
+
export type MultibodyJointHandle = number;
|
|
6
|
+
export declare class MultibodyJoint {
|
|
7
|
+
protected rawSet: RawMultibodyJointSet;
|
|
8
|
+
handle: MultibodyJointHandle;
|
|
9
|
+
constructor(rawSet: RawMultibodyJointSet, handle: MultibodyJointHandle);
|
|
10
|
+
static newTyped(rawSet: RawMultibodyJointSet, handle: MultibodyJointHandle): MultibodyJoint;
|
|
11
|
+
/**
|
|
12
|
+
* Checks if this joint is still valid (i.e. that it has
|
|
13
|
+
* not been deleted from the joint set yet).
|
|
14
|
+
*/
|
|
15
|
+
isValid(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Controls whether contacts are computed between colliders attached
|
|
18
|
+
* to the rigid-bodies linked by this joint.
|
|
19
|
+
*/
|
|
20
|
+
setContactsEnabled(enabled: boolean): void;
|
|
21
|
+
/**
|
|
22
|
+
* Indicates if contacts are enabled between colliders attached
|
|
23
|
+
* to the rigid-bodies linked by this joint.
|
|
24
|
+
*/
|
|
25
|
+
contactsEnabled(): boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class UnitMultibodyJoint extends MultibodyJoint {
|
|
28
|
+
/**
|
|
29
|
+
* The axis left free by this joint.
|
|
30
|
+
*/
|
|
31
|
+
protected rawAxis?(): RawJointAxis;
|
|
32
|
+
}
|
|
33
|
+
export declare class FixedMultibodyJoint extends MultibodyJoint {
|
|
34
|
+
}
|
|
35
|
+
export declare class PrismaticMultibodyJoint extends UnitMultibodyJoint {
|
|
36
|
+
rawAxis(): RawJointAxis;
|
|
37
|
+
}
|
|
38
|
+
export declare class RevoluteMultibodyJoint extends UnitMultibodyJoint {
|
|
39
|
+
rawAxis(): RawJointAxis;
|
|
40
|
+
}
|
|
41
|
+
export declare class SphericalMultibodyJoint extends MultibodyJoint {
|
|
42
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { RawJointAxis } from "../raw";
|
|
2
|
+
import { JointType, } from "./impulse_joint";
|
|
3
|
+
export class MultibodyJoint {
|
|
4
|
+
constructor(rawSet, handle) {
|
|
5
|
+
this.rawSet = rawSet;
|
|
6
|
+
this.handle = handle;
|
|
7
|
+
}
|
|
8
|
+
static newTyped(rawSet, handle) {
|
|
9
|
+
switch (rawSet.jointType(handle)) {
|
|
10
|
+
case JointType.Revolute:
|
|
11
|
+
return new RevoluteMultibodyJoint(rawSet, handle);
|
|
12
|
+
case JointType.Prismatic:
|
|
13
|
+
return new PrismaticMultibodyJoint(rawSet, handle);
|
|
14
|
+
case JointType.Fixed:
|
|
15
|
+
return new FixedMultibodyJoint(rawSet, handle);
|
|
16
|
+
// #if DIM3
|
|
17
|
+
case JointType.Spherical:
|
|
18
|
+
return new SphericalMultibodyJoint(rawSet, handle);
|
|
19
|
+
// #endif
|
|
20
|
+
default:
|
|
21
|
+
return new MultibodyJoint(rawSet, handle);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Checks if this joint is still valid (i.e. that it has
|
|
26
|
+
* not been deleted from the joint set yet).
|
|
27
|
+
*/
|
|
28
|
+
isValid() {
|
|
29
|
+
return this.rawSet.contains(this.handle);
|
|
30
|
+
}
|
|
31
|
+
// /**
|
|
32
|
+
// * The unique integer identifier of the first rigid-body this joint it attached to.
|
|
33
|
+
// */
|
|
34
|
+
// public bodyHandle1(): RigidBodyHandle {
|
|
35
|
+
// return this.rawSet.jointBodyHandle1(this.handle);
|
|
36
|
+
// }
|
|
37
|
+
//
|
|
38
|
+
// /**
|
|
39
|
+
// * The unique integer identifier of the second rigid-body this joint is attached to.
|
|
40
|
+
// */
|
|
41
|
+
// public bodyHandle2(): RigidBodyHandle {
|
|
42
|
+
// return this.rawSet.jointBodyHandle2(this.handle);
|
|
43
|
+
// }
|
|
44
|
+
//
|
|
45
|
+
// /**
|
|
46
|
+
// * The type of this joint given as a string.
|
|
47
|
+
// */
|
|
48
|
+
// public type(): JointType {
|
|
49
|
+
// return this.rawSet.jointType(this.handle);
|
|
50
|
+
// }
|
|
51
|
+
//
|
|
52
|
+
// // #if DIM3
|
|
53
|
+
// /**
|
|
54
|
+
// * The rotation quaternion that aligns this joint's first local axis to the `x` axis.
|
|
55
|
+
// */
|
|
56
|
+
// public frameX1(): Rotation {
|
|
57
|
+
// return RotationOps.fromRaw(this.rawSet.jointFrameX1(this.handle));
|
|
58
|
+
// }
|
|
59
|
+
//
|
|
60
|
+
// // #endif
|
|
61
|
+
//
|
|
62
|
+
// // #if DIM3
|
|
63
|
+
// /**
|
|
64
|
+
// * The rotation matrix that aligns this joint's second local axis to the `x` axis.
|
|
65
|
+
// */
|
|
66
|
+
// public frameX2(): Rotation {
|
|
67
|
+
// return RotationOps.fromRaw(this.rawSet.jointFrameX2(this.handle));
|
|
68
|
+
// }
|
|
69
|
+
//
|
|
70
|
+
// // #endif
|
|
71
|
+
//
|
|
72
|
+
// /**
|
|
73
|
+
// * The position of the first anchor of this joint.
|
|
74
|
+
// *
|
|
75
|
+
// * The first anchor gives the position of the points application point on the
|
|
76
|
+
// * local frame of the first rigid-body it is attached to.
|
|
77
|
+
// */
|
|
78
|
+
// public anchor1(): Vector {
|
|
79
|
+
// return VectorOps.fromRaw(this.rawSet.jointAnchor1(this.handle));
|
|
80
|
+
// }
|
|
81
|
+
//
|
|
82
|
+
// /**
|
|
83
|
+
// * The position of the second anchor of this joint.
|
|
84
|
+
// *
|
|
85
|
+
// * The second anchor gives the position of the points application point on the
|
|
86
|
+
// * local frame of the second rigid-body it is attached to.
|
|
87
|
+
// */
|
|
88
|
+
// public anchor2(): Vector {
|
|
89
|
+
// return VectorOps.fromRaw(this.rawSet.jointAnchor2(this.handle));
|
|
90
|
+
// }
|
|
91
|
+
/**
|
|
92
|
+
* Controls whether contacts are computed between colliders attached
|
|
93
|
+
* to the rigid-bodies linked by this joint.
|
|
94
|
+
*/
|
|
95
|
+
setContactsEnabled(enabled) {
|
|
96
|
+
this.rawSet.jointSetContactsEnabled(this.handle, enabled);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Indicates if contacts are enabled between colliders attached
|
|
100
|
+
* to the rigid-bodies linked by this joint.
|
|
101
|
+
*/
|
|
102
|
+
contactsEnabled() {
|
|
103
|
+
return this.rawSet.jointContactsEnabled(this.handle);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export class UnitMultibodyJoint extends MultibodyJoint {
|
|
107
|
+
}
|
|
108
|
+
export class FixedMultibodyJoint extends MultibodyJoint {
|
|
109
|
+
}
|
|
110
|
+
export class PrismaticMultibodyJoint extends UnitMultibodyJoint {
|
|
111
|
+
rawAxis() {
|
|
112
|
+
return RawJointAxis.X;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
export class RevoluteMultibodyJoint extends UnitMultibodyJoint {
|
|
116
|
+
rawAxis() {
|
|
117
|
+
return RawJointAxis.AngX;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// #if DIM3
|
|
121
|
+
export class SphericalMultibodyJoint extends MultibodyJoint {
|
|
122
|
+
}
|
|
123
|
+
// #endif
|
|
124
|
+
//# sourceMappingURL=multibody_joint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multibody_joint.js","sourceRoot":"","sources":["../src/dynamics/multibody_joint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAuB,MAAM,QAAQ,CAAC;AAC9E,OAAO,EAGH,SAAS,GAIZ,MAAM,iBAAiB,CAAC;AAYzB,MAAM,OAAO,cAAc;IAIvB,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IACd,MAAM;IACN,qFAAqF;IACrF,MAAM;IACN,+BAA+B;IAC/B,yEAAyE;IACzE,IAAI;IACJ,EAAE;IACF,YAAY;IACZ,EAAE;IACF,MAAM;IACN,qDAAqD;IACrD,KAAK;IACL,gFAAgF;IAChF,4DAA4D;IAC5D,MAAM;IACN,6BAA6B;IAC7B,uEAAuE;IACvE,IAAI;IACJ,EAAE;IACF,MAAM;IACN,sDAAsD;IACtD,KAAK;IACL,iFAAiF;IACjF,6DAA6D;IAC7D,MAAM;IACN,6BAA6B;IAC7B,uEAAuE;IACvE,IAAI;IAEJ;;;OAGG;IACI,kBAAkB,CAAC,OAAgB;QACtC,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED;;;OAGG;IACI,eAAe;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;CACJ;AAED,MAAM,OAAO,kBAAmB,SAAQ,cAAc;CA0CrD;AAED,MAAM,OAAO,mBAAoB,SAAQ,cAAc;CAAG;AAE1D,MAAM,OAAO,uBAAwB,SAAQ,kBAAkB;IACpD,OAAO;QACV,OAAO,YAAY,CAAC,CAAC,CAAC;IAC1B,CAAC;CACJ;AAED,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IACnD,OAAO;QACV,OAAO,YAAY,CAAC,IAAI,CAAC;IAC7B,CAAC;CACJ;AAED,WAAW;AACX,MAAM,OAAO,uBAAwB,SAAQ,cAAc;CAqB1D;AACD,SAAS"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { RawMultibodyJointSet } from "../raw";
|
|
2
|
+
import { MultibodyJoint, MultibodyJointHandle } from "./multibody_joint";
|
|
3
|
+
import { JointData } from "./impulse_joint";
|
|
4
|
+
import { RigidBodyHandle } from "./rigid_body";
|
|
5
|
+
/**
|
|
6
|
+
* A set of joints.
|
|
7
|
+
*
|
|
8
|
+
* To avoid leaking WASM resources, this MUST be freed manually with `jointSet.free()`
|
|
9
|
+
* once you are done using it (and all the joints it created).
|
|
10
|
+
*/
|
|
11
|
+
export declare class MultibodyJointSet {
|
|
12
|
+
raw: RawMultibodyJointSet;
|
|
13
|
+
private map;
|
|
14
|
+
/**
|
|
15
|
+
* Release the WASM memory occupied by this joint set.
|
|
16
|
+
*/
|
|
17
|
+
free(): void;
|
|
18
|
+
constructor(raw?: RawMultibodyJointSet);
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new joint and return its integer handle.
|
|
21
|
+
*
|
|
22
|
+
* @param desc - The joint's parameters.
|
|
23
|
+
* @param parent1 - The handle of the first rigid-body this joint is attached to.
|
|
24
|
+
* @param parent2 - The handle of the second rigid-body this joint is attached to.
|
|
25
|
+
* @param wakeUp - Should the attached rigid-bodies be awakened?
|
|
26
|
+
*/
|
|
27
|
+
createJoint(desc: JointData, parent1: RigidBodyHandle, parent2: RigidBodyHandle, wakeUp: boolean): MultibodyJoint;
|
|
28
|
+
/**
|
|
29
|
+
* Remove a joint from this set.
|
|
30
|
+
*
|
|
31
|
+
* @param handle - The integer handle of the joint.
|
|
32
|
+
* @param wake_up - If `true`, the rigid-bodies attached by the removed joint will be woken-up automatically.
|
|
33
|
+
*/
|
|
34
|
+
remove(handle: MultibodyJointHandle, wake_up: boolean): void;
|
|
35
|
+
/**
|
|
36
|
+
* Internal function, do not call directly.
|
|
37
|
+
* @param handle
|
|
38
|
+
*/
|
|
39
|
+
unmap(handle: MultibodyJointHandle): void;
|
|
40
|
+
/**
|
|
41
|
+
* The number of joints on this set.
|
|
42
|
+
*/
|
|
43
|
+
len(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Does this set contain a joint with the given handle?
|
|
46
|
+
*
|
|
47
|
+
* @param handle - The joint handle to check.
|
|
48
|
+
*/
|
|
49
|
+
contains(handle: MultibodyJointHandle): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Gets the joint with the given handle.
|
|
52
|
+
*
|
|
53
|
+
* Returns `null` if no joint with the specified handle exists.
|
|
54
|
+
*
|
|
55
|
+
* @param handle - The integer handle of the joint to retrieve.
|
|
56
|
+
*/
|
|
57
|
+
get(handle: MultibodyJointHandle): MultibodyJoint | null;
|
|
58
|
+
/**
|
|
59
|
+
* Applies the given closure to each joint contained by this set.
|
|
60
|
+
*
|
|
61
|
+
* @param f - The closure to apply.
|
|
62
|
+
*/
|
|
63
|
+
forEach(f: (joint: MultibodyJoint) => void): void;
|
|
64
|
+
/**
|
|
65
|
+
* Calls the given closure with the integer handle of each multibody joint attached to this rigid-body.
|
|
66
|
+
*
|
|
67
|
+
* @param f - The closure called with the integer handle of each multibody joint attached to the rigid-body.
|
|
68
|
+
*/
|
|
69
|
+
forEachJointHandleAttachedToRigidBody(handle: RigidBodyHandle, f: (handle: MultibodyJointHandle) => void): void;
|
|
70
|
+
/**
|
|
71
|
+
* Gets all joints in the list.
|
|
72
|
+
*
|
|
73
|
+
* @returns joint list.
|
|
74
|
+
*/
|
|
75
|
+
getAll(): MultibodyJoint[];
|
|
76
|
+
}
|