@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,204 @@
|
|
|
1
|
+
import { Rotation, Vector } from "../math";
|
|
2
|
+
import { RawGenericJoint, RawImpulseJointSet, RawJointAxis } from "../raw";
|
|
3
|
+
import { RigidBody } from "./rigid_body";
|
|
4
|
+
import { RigidBodySet } from "./rigid_body_set";
|
|
5
|
+
/**
|
|
6
|
+
* The integer identifier of a collider added to a `ColliderSet`.
|
|
7
|
+
*/
|
|
8
|
+
export type ImpulseJointHandle = number;
|
|
9
|
+
/**
|
|
10
|
+
* An enum grouping all possible types of joints:
|
|
11
|
+
*
|
|
12
|
+
* - `Revolute`: A revolute joint that removes all degrees of freedom between the affected
|
|
13
|
+
* bodies except for the rotation along one axis.
|
|
14
|
+
* - `Fixed`: A fixed joint that removes all relative degrees of freedom between the affected bodies.
|
|
15
|
+
* - `Prismatic`: A prismatic joint that removes all degrees of freedom between the affected
|
|
16
|
+
* bodies except for the translation along one axis.
|
|
17
|
+
* - `Spherical`: (3D only) A spherical joint that removes all relative linear degrees of freedom between the affected bodies.
|
|
18
|
+
*/
|
|
19
|
+
export declare enum JointType {
|
|
20
|
+
Revolute = 0,
|
|
21
|
+
Fixed = 1,
|
|
22
|
+
Prismatic = 2,
|
|
23
|
+
Spherical = 3
|
|
24
|
+
}
|
|
25
|
+
export declare enum MotorModel {
|
|
26
|
+
AccelerationBased = 0,
|
|
27
|
+
ForceBased = 1
|
|
28
|
+
}
|
|
29
|
+
export declare class ImpulseJoint {
|
|
30
|
+
protected rawSet: RawImpulseJointSet;
|
|
31
|
+
protected bodySet: RigidBodySet;
|
|
32
|
+
handle: ImpulseJointHandle;
|
|
33
|
+
constructor(rawSet: RawImpulseJointSet, bodySet: RigidBodySet, handle: ImpulseJointHandle);
|
|
34
|
+
static newTyped(rawSet: RawImpulseJointSet, bodySet: RigidBodySet, handle: ImpulseJointHandle): ImpulseJoint;
|
|
35
|
+
/** @internal */
|
|
36
|
+
finalizeDeserialization(bodySet: RigidBodySet): void;
|
|
37
|
+
/**
|
|
38
|
+
* Checks if this joint is still valid (i.e. that it has
|
|
39
|
+
* not been deleted from the joint set yet).
|
|
40
|
+
*/
|
|
41
|
+
isValid(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The first rigid-body this joint it attached to.
|
|
44
|
+
*/
|
|
45
|
+
body1(): RigidBody;
|
|
46
|
+
/**
|
|
47
|
+
* The second rigid-body this joint is attached to.
|
|
48
|
+
*/
|
|
49
|
+
body2(): RigidBody;
|
|
50
|
+
/**
|
|
51
|
+
* The type of this joint given as a string.
|
|
52
|
+
*/
|
|
53
|
+
type(): JointType;
|
|
54
|
+
/**
|
|
55
|
+
* The rotation quaternion that aligns this joint's first local axis to the `x` axis.
|
|
56
|
+
*/
|
|
57
|
+
frameX1(): Rotation;
|
|
58
|
+
/**
|
|
59
|
+
* The rotation matrix that aligns this joint's second local axis to the `x` axis.
|
|
60
|
+
*/
|
|
61
|
+
frameX2(): Rotation;
|
|
62
|
+
/**
|
|
63
|
+
* The position of the first anchor of this joint.
|
|
64
|
+
*
|
|
65
|
+
* The first anchor gives the position of the application point on the
|
|
66
|
+
* local frame of the first rigid-body it is attached to.
|
|
67
|
+
*/
|
|
68
|
+
anchor1(): Vector;
|
|
69
|
+
/**
|
|
70
|
+
* The position of the second anchor of this joint.
|
|
71
|
+
*
|
|
72
|
+
* The second anchor gives the position of the application point on the
|
|
73
|
+
* local frame of the second rigid-body it is attached to.
|
|
74
|
+
*/
|
|
75
|
+
anchor2(): Vector;
|
|
76
|
+
/**
|
|
77
|
+
* Sets the position of the first anchor of this joint.
|
|
78
|
+
*
|
|
79
|
+
* The first anchor gives the position of the application point on the
|
|
80
|
+
* local frame of the first rigid-body it is attached to.
|
|
81
|
+
*/
|
|
82
|
+
setAnchor1(newPos: Vector): void;
|
|
83
|
+
/**
|
|
84
|
+
* Sets the position of the second anchor of this joint.
|
|
85
|
+
*
|
|
86
|
+
* The second anchor gives the position of the application point on the
|
|
87
|
+
* local frame of the second rigid-body it is attached to.
|
|
88
|
+
*/
|
|
89
|
+
setAnchor2(newPos: Vector): void;
|
|
90
|
+
/**
|
|
91
|
+
* Controls whether contacts are computed between colliders attached
|
|
92
|
+
* to the rigid-bodies linked by this joint.
|
|
93
|
+
*/
|
|
94
|
+
setContactsEnabled(enabled: boolean): void;
|
|
95
|
+
/**
|
|
96
|
+
* Indicates if contacts are enabled between colliders attached
|
|
97
|
+
* to the rigid-bodies linked by this joint.
|
|
98
|
+
*/
|
|
99
|
+
contactsEnabled(): boolean;
|
|
100
|
+
}
|
|
101
|
+
export declare class UnitImpulseJoint extends ImpulseJoint {
|
|
102
|
+
/**
|
|
103
|
+
* The axis left free by this joint.
|
|
104
|
+
*/
|
|
105
|
+
protected rawAxis?(): RawJointAxis;
|
|
106
|
+
/**
|
|
107
|
+
* Are the limits enabled for this joint?
|
|
108
|
+
*/
|
|
109
|
+
limitsEnabled(): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* The min limit of this joint.
|
|
112
|
+
*/
|
|
113
|
+
limitsMin(): number;
|
|
114
|
+
/**
|
|
115
|
+
* The max limit of this joint.
|
|
116
|
+
*/
|
|
117
|
+
limitsMax(): number;
|
|
118
|
+
/**
|
|
119
|
+
* Sets the limits of this joint.
|
|
120
|
+
*
|
|
121
|
+
* @param min - The minimum bound of this joint’s free coordinate.
|
|
122
|
+
* @param max - The maximum bound of this joint’s free coordinate.
|
|
123
|
+
*/
|
|
124
|
+
setLimits(min: number, max: number): void;
|
|
125
|
+
configureMotorModel(model: MotorModel): void;
|
|
126
|
+
configureMotorVelocity(targetVel: number, factor: number): void;
|
|
127
|
+
configureMotorPosition(targetPos: number, stiffness: number, damping: number): void;
|
|
128
|
+
configureMotor(targetPos: number, targetVel: number, stiffness: number, damping: number): void;
|
|
129
|
+
}
|
|
130
|
+
export declare class FixedImpulseJoint extends ImpulseJoint {
|
|
131
|
+
}
|
|
132
|
+
export declare class PrismaticImpulseJoint extends UnitImpulseJoint {
|
|
133
|
+
rawAxis(): RawJointAxis;
|
|
134
|
+
}
|
|
135
|
+
export declare class RevoluteImpulseJoint extends UnitImpulseJoint {
|
|
136
|
+
rawAxis(): RawJointAxis;
|
|
137
|
+
}
|
|
138
|
+
export declare class SphericalImpulseJoint extends ImpulseJoint {
|
|
139
|
+
}
|
|
140
|
+
export declare class JointData {
|
|
141
|
+
anchor1: Vector;
|
|
142
|
+
anchor2: Vector;
|
|
143
|
+
axis: Vector;
|
|
144
|
+
frame1: Rotation;
|
|
145
|
+
frame2: Rotation;
|
|
146
|
+
jointType: JointType;
|
|
147
|
+
limitsEnabled: boolean;
|
|
148
|
+
limits: Array<number>;
|
|
149
|
+
private constructor();
|
|
150
|
+
/**
|
|
151
|
+
* Creates a new joint descriptor that builds a Fixed joint.
|
|
152
|
+
*
|
|
153
|
+
* A fixed joint removes all the degrees of freedom between the affected bodies, ensuring their
|
|
154
|
+
* anchor and local frames coincide in world-space.
|
|
155
|
+
*
|
|
156
|
+
* @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
|
|
157
|
+
* local-space of the rigid-body.
|
|
158
|
+
* @param frame1 - The reference orientation of the joint wrt. the first rigid-body.
|
|
159
|
+
* @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
|
|
160
|
+
* local-space of the rigid-body.
|
|
161
|
+
* @param frame2 - The reference orientation of the joint wrt. the second rigid-body.
|
|
162
|
+
*/
|
|
163
|
+
static fixed(anchor1: Vector, frame1: Rotation, anchor2: Vector, frame2: Rotation): JointData;
|
|
164
|
+
/**
|
|
165
|
+
* Create a new joint descriptor that builds spherical joints.
|
|
166
|
+
*
|
|
167
|
+
* A spherical joint allows three relative rotational degrees of freedom
|
|
168
|
+
* by preventing any relative translation between the anchors of the
|
|
169
|
+
* two attached rigid-bodies.
|
|
170
|
+
*
|
|
171
|
+
* @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
|
|
172
|
+
* local-space of the rigid-body.
|
|
173
|
+
* @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
|
|
174
|
+
* local-space of the rigid-body.
|
|
175
|
+
*/
|
|
176
|
+
static spherical(anchor1: Vector, anchor2: Vector): JointData;
|
|
177
|
+
/**
|
|
178
|
+
* Creates a new joint descriptor that builds a Prismatic joint.
|
|
179
|
+
*
|
|
180
|
+
* A prismatic joint removes all the degrees of freedom between the
|
|
181
|
+
* affected bodies, except for the translation along one axis.
|
|
182
|
+
*
|
|
183
|
+
* @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
|
|
184
|
+
* local-space of the rigid-body.
|
|
185
|
+
* @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
|
|
186
|
+
* local-space of the rigid-body.
|
|
187
|
+
* @param axis - Axis of the joint, expressed in the local-space of the rigid-bodies it is attached to.
|
|
188
|
+
*/
|
|
189
|
+
static prismatic(anchor1: Vector, anchor2: Vector, axis: Vector): JointData;
|
|
190
|
+
/**
|
|
191
|
+
* Create a new joint descriptor that builds Revolute joints.
|
|
192
|
+
*
|
|
193
|
+
* A revolute joint removes all degrees of freedom between the affected
|
|
194
|
+
* bodies except for the rotation along one axis.
|
|
195
|
+
*
|
|
196
|
+
* @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
|
|
197
|
+
* local-space of the rigid-body.
|
|
198
|
+
* @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
|
|
199
|
+
* local-space of the rigid-body.
|
|
200
|
+
* @param axis - Axis of the joint, expressed in the local-space of the rigid-bodies it is attached to.
|
|
201
|
+
*/
|
|
202
|
+
static revolute(anchor1: Vector, anchor2: Vector, axis: Vector): JointData;
|
|
203
|
+
intoRaw(): RawGenericJoint;
|
|
204
|
+
}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { VectorOps, RotationOps } from "../math";
|
|
2
|
+
import { RawGenericJoint, RawJointAxis, } from "../raw";
|
|
3
|
+
/**
|
|
4
|
+
* An enum grouping all possible types of joints:
|
|
5
|
+
*
|
|
6
|
+
* - `Revolute`: A revolute joint that removes all degrees of freedom between the affected
|
|
7
|
+
* bodies except for the rotation along one axis.
|
|
8
|
+
* - `Fixed`: A fixed joint that removes all relative degrees of freedom between the affected bodies.
|
|
9
|
+
* - `Prismatic`: A prismatic joint that removes all degrees of freedom between the affected
|
|
10
|
+
* bodies except for the translation along one axis.
|
|
11
|
+
* - `Spherical`: (3D only) A spherical joint that removes all relative linear degrees of freedom between the affected bodies.
|
|
12
|
+
*/
|
|
13
|
+
export var JointType;
|
|
14
|
+
(function (JointType) {
|
|
15
|
+
JointType[JointType["Revolute"] = 0] = "Revolute";
|
|
16
|
+
JointType[JointType["Fixed"] = 1] = "Fixed";
|
|
17
|
+
JointType[JointType["Prismatic"] = 2] = "Prismatic";
|
|
18
|
+
// #if DIM3
|
|
19
|
+
JointType[JointType["Spherical"] = 3] = "Spherical";
|
|
20
|
+
// #endif
|
|
21
|
+
})(JointType || (JointType = {}));
|
|
22
|
+
export var MotorModel;
|
|
23
|
+
(function (MotorModel) {
|
|
24
|
+
MotorModel[MotorModel["AccelerationBased"] = 0] = "AccelerationBased";
|
|
25
|
+
MotorModel[MotorModel["ForceBased"] = 1] = "ForceBased";
|
|
26
|
+
})(MotorModel || (MotorModel = {}));
|
|
27
|
+
export class ImpulseJoint {
|
|
28
|
+
constructor(rawSet, bodySet, handle) {
|
|
29
|
+
this.rawSet = rawSet;
|
|
30
|
+
this.bodySet = bodySet;
|
|
31
|
+
this.handle = handle;
|
|
32
|
+
}
|
|
33
|
+
static newTyped(rawSet, bodySet, handle) {
|
|
34
|
+
switch (rawSet.jointType(handle)) {
|
|
35
|
+
case JointType.Revolute:
|
|
36
|
+
return new RevoluteImpulseJoint(rawSet, bodySet, handle);
|
|
37
|
+
case JointType.Prismatic:
|
|
38
|
+
return new PrismaticImpulseJoint(rawSet, bodySet, handle);
|
|
39
|
+
case JointType.Fixed:
|
|
40
|
+
return new FixedImpulseJoint(rawSet, bodySet, handle);
|
|
41
|
+
// #if DIM3
|
|
42
|
+
case JointType.Spherical:
|
|
43
|
+
return new SphericalImpulseJoint(rawSet, bodySet, handle);
|
|
44
|
+
// #endif
|
|
45
|
+
default:
|
|
46
|
+
return new ImpulseJoint(rawSet, bodySet, handle);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** @internal */
|
|
50
|
+
finalizeDeserialization(bodySet) {
|
|
51
|
+
this.bodySet = bodySet;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Checks if this joint is still valid (i.e. that it has
|
|
55
|
+
* not been deleted from the joint set yet).
|
|
56
|
+
*/
|
|
57
|
+
isValid() {
|
|
58
|
+
return this.rawSet.contains(this.handle);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The first rigid-body this joint it attached to.
|
|
62
|
+
*/
|
|
63
|
+
body1() {
|
|
64
|
+
return this.bodySet.get(this.rawSet.jointBodyHandle1(this.handle));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The second rigid-body this joint is attached to.
|
|
68
|
+
*/
|
|
69
|
+
body2() {
|
|
70
|
+
return this.bodySet.get(this.rawSet.jointBodyHandle2(this.handle));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The type of this joint given as a string.
|
|
74
|
+
*/
|
|
75
|
+
type() {
|
|
76
|
+
return this.rawSet.jointType(this.handle);
|
|
77
|
+
}
|
|
78
|
+
// #if DIM3
|
|
79
|
+
/**
|
|
80
|
+
* The rotation quaternion that aligns this joint's first local axis to the `x` axis.
|
|
81
|
+
*/
|
|
82
|
+
frameX1() {
|
|
83
|
+
return RotationOps.fromRaw(this.rawSet.jointFrameX1(this.handle));
|
|
84
|
+
}
|
|
85
|
+
// #endif
|
|
86
|
+
// #if DIM3
|
|
87
|
+
/**
|
|
88
|
+
* The rotation matrix that aligns this joint's second local axis to the `x` axis.
|
|
89
|
+
*/
|
|
90
|
+
frameX2() {
|
|
91
|
+
return RotationOps.fromRaw(this.rawSet.jointFrameX2(this.handle));
|
|
92
|
+
}
|
|
93
|
+
// #endif
|
|
94
|
+
/**
|
|
95
|
+
* The position of the first anchor of this joint.
|
|
96
|
+
*
|
|
97
|
+
* The first anchor gives the position of the application point on the
|
|
98
|
+
* local frame of the first rigid-body it is attached to.
|
|
99
|
+
*/
|
|
100
|
+
anchor1() {
|
|
101
|
+
return VectorOps.fromRaw(this.rawSet.jointAnchor1(this.handle));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The position of the second anchor of this joint.
|
|
105
|
+
*
|
|
106
|
+
* The second anchor gives the position of the application point on the
|
|
107
|
+
* local frame of the second rigid-body it is attached to.
|
|
108
|
+
*/
|
|
109
|
+
anchor2() {
|
|
110
|
+
return VectorOps.fromRaw(this.rawSet.jointAnchor2(this.handle));
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Sets the position of the first anchor of this joint.
|
|
114
|
+
*
|
|
115
|
+
* The first anchor gives the position of the application point on the
|
|
116
|
+
* local frame of the first rigid-body it is attached to.
|
|
117
|
+
*/
|
|
118
|
+
setAnchor1(newPos) {
|
|
119
|
+
const rawPoint = VectorOps.intoRaw(newPos);
|
|
120
|
+
this.rawSet.jointSetAnchor1(this.handle, rawPoint);
|
|
121
|
+
rawPoint.free();
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Sets the position of the second anchor of this joint.
|
|
125
|
+
*
|
|
126
|
+
* The second anchor gives the position of the application point on the
|
|
127
|
+
* local frame of the second rigid-body it is attached to.
|
|
128
|
+
*/
|
|
129
|
+
setAnchor2(newPos) {
|
|
130
|
+
const rawPoint = VectorOps.intoRaw(newPos);
|
|
131
|
+
this.rawSet.jointSetAnchor2(this.handle, rawPoint);
|
|
132
|
+
rawPoint.free();
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Controls whether contacts are computed between colliders attached
|
|
136
|
+
* to the rigid-bodies linked by this joint.
|
|
137
|
+
*/
|
|
138
|
+
setContactsEnabled(enabled) {
|
|
139
|
+
this.rawSet.jointSetContactsEnabled(this.handle, enabled);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Indicates if contacts are enabled between colliders attached
|
|
143
|
+
* to the rigid-bodies linked by this joint.
|
|
144
|
+
*/
|
|
145
|
+
contactsEnabled() {
|
|
146
|
+
return this.rawSet.jointContactsEnabled(this.handle);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
export class UnitImpulseJoint extends ImpulseJoint {
|
|
150
|
+
/**
|
|
151
|
+
* Are the limits enabled for this joint?
|
|
152
|
+
*/
|
|
153
|
+
limitsEnabled() {
|
|
154
|
+
return this.rawSet.jointLimitsEnabled(this.handle, this.rawAxis());
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The min limit of this joint.
|
|
158
|
+
*/
|
|
159
|
+
limitsMin() {
|
|
160
|
+
return this.rawSet.jointLimitsMin(this.handle, this.rawAxis());
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The max limit of this joint.
|
|
164
|
+
*/
|
|
165
|
+
limitsMax() {
|
|
166
|
+
return this.rawSet.jointLimitsMax(this.handle, this.rawAxis());
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Sets the limits of this joint.
|
|
170
|
+
*
|
|
171
|
+
* @param min - The minimum bound of this joint’s free coordinate.
|
|
172
|
+
* @param max - The maximum bound of this joint’s free coordinate.
|
|
173
|
+
*/
|
|
174
|
+
setLimits(min, max) {
|
|
175
|
+
this.rawSet.jointSetLimits(this.handle, this.rawAxis(), min, max);
|
|
176
|
+
}
|
|
177
|
+
configureMotorModel(model) {
|
|
178
|
+
this.rawSet.jointConfigureMotorModel(this.handle, this.rawAxis(), model);
|
|
179
|
+
}
|
|
180
|
+
configureMotorVelocity(targetVel, factor) {
|
|
181
|
+
this.rawSet.jointConfigureMotorVelocity(this.handle, this.rawAxis(), targetVel, factor);
|
|
182
|
+
}
|
|
183
|
+
configureMotorPosition(targetPos, stiffness, damping) {
|
|
184
|
+
this.rawSet.jointConfigureMotorPosition(this.handle, this.rawAxis(), targetPos, stiffness, damping);
|
|
185
|
+
}
|
|
186
|
+
configureMotor(targetPos, targetVel, stiffness, damping) {
|
|
187
|
+
this.rawSet.jointConfigureMotor(this.handle, this.rawAxis(), targetPos, targetVel, stiffness, damping);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
export class FixedImpulseJoint extends ImpulseJoint {
|
|
191
|
+
}
|
|
192
|
+
export class PrismaticImpulseJoint extends UnitImpulseJoint {
|
|
193
|
+
rawAxis() {
|
|
194
|
+
return RawJointAxis.X;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
export class RevoluteImpulseJoint extends UnitImpulseJoint {
|
|
198
|
+
rawAxis() {
|
|
199
|
+
return RawJointAxis.AngX;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// #if DIM3
|
|
203
|
+
export class SphericalImpulseJoint extends ImpulseJoint {
|
|
204
|
+
}
|
|
205
|
+
// #endif
|
|
206
|
+
export class JointData {
|
|
207
|
+
constructor() { }
|
|
208
|
+
/**
|
|
209
|
+
* Creates a new joint descriptor that builds a Fixed joint.
|
|
210
|
+
*
|
|
211
|
+
* A fixed joint removes all the degrees of freedom between the affected bodies, ensuring their
|
|
212
|
+
* anchor and local frames coincide in world-space.
|
|
213
|
+
*
|
|
214
|
+
* @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
|
|
215
|
+
* local-space of the rigid-body.
|
|
216
|
+
* @param frame1 - The reference orientation of the joint wrt. the first rigid-body.
|
|
217
|
+
* @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
|
|
218
|
+
* local-space of the rigid-body.
|
|
219
|
+
* @param frame2 - The reference orientation of the joint wrt. the second rigid-body.
|
|
220
|
+
*/
|
|
221
|
+
static fixed(anchor1, frame1, anchor2, frame2) {
|
|
222
|
+
let res = new JointData();
|
|
223
|
+
res.anchor1 = anchor1;
|
|
224
|
+
res.anchor2 = anchor2;
|
|
225
|
+
res.frame1 = frame1;
|
|
226
|
+
res.frame2 = frame2;
|
|
227
|
+
res.jointType = JointType.Fixed;
|
|
228
|
+
return res;
|
|
229
|
+
}
|
|
230
|
+
// #if DIM3
|
|
231
|
+
/**
|
|
232
|
+
* Create a new joint descriptor that builds spherical joints.
|
|
233
|
+
*
|
|
234
|
+
* A spherical joint allows three relative rotational degrees of freedom
|
|
235
|
+
* by preventing any relative translation between the anchors of the
|
|
236
|
+
* two attached rigid-bodies.
|
|
237
|
+
*
|
|
238
|
+
* @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
|
|
239
|
+
* local-space of the rigid-body.
|
|
240
|
+
* @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
|
|
241
|
+
* local-space of the rigid-body.
|
|
242
|
+
*/
|
|
243
|
+
static spherical(anchor1, anchor2) {
|
|
244
|
+
let res = new JointData();
|
|
245
|
+
res.anchor1 = anchor1;
|
|
246
|
+
res.anchor2 = anchor2;
|
|
247
|
+
res.jointType = JointType.Spherical;
|
|
248
|
+
return res;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Creates a new joint descriptor that builds a Prismatic joint.
|
|
252
|
+
*
|
|
253
|
+
* A prismatic joint removes all the degrees of freedom between the
|
|
254
|
+
* affected bodies, except for the translation along one axis.
|
|
255
|
+
*
|
|
256
|
+
* @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
|
|
257
|
+
* local-space of the rigid-body.
|
|
258
|
+
* @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
|
|
259
|
+
* local-space of the rigid-body.
|
|
260
|
+
* @param axis - Axis of the joint, expressed in the local-space of the rigid-bodies it is attached to.
|
|
261
|
+
*/
|
|
262
|
+
static prismatic(anchor1, anchor2, axis) {
|
|
263
|
+
let res = new JointData();
|
|
264
|
+
res.anchor1 = anchor1;
|
|
265
|
+
res.anchor2 = anchor2;
|
|
266
|
+
res.axis = axis;
|
|
267
|
+
res.jointType = JointType.Prismatic;
|
|
268
|
+
return res;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Create a new joint descriptor that builds Revolute joints.
|
|
272
|
+
*
|
|
273
|
+
* A revolute joint removes all degrees of freedom between the affected
|
|
274
|
+
* bodies except for the rotation along one axis.
|
|
275
|
+
*
|
|
276
|
+
* @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
|
|
277
|
+
* local-space of the rigid-body.
|
|
278
|
+
* @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
|
|
279
|
+
* local-space of the rigid-body.
|
|
280
|
+
* @param axis - Axis of the joint, expressed in the local-space of the rigid-bodies it is attached to.
|
|
281
|
+
*/
|
|
282
|
+
static revolute(anchor1, anchor2, axis) {
|
|
283
|
+
let res = new JointData();
|
|
284
|
+
res.anchor1 = anchor1;
|
|
285
|
+
res.anchor2 = anchor2;
|
|
286
|
+
res.axis = axis;
|
|
287
|
+
res.jointType = JointType.Revolute;
|
|
288
|
+
return res;
|
|
289
|
+
}
|
|
290
|
+
// #endif
|
|
291
|
+
intoRaw() {
|
|
292
|
+
let rawA1 = VectorOps.intoRaw(this.anchor1);
|
|
293
|
+
let rawA2 = VectorOps.intoRaw(this.anchor2);
|
|
294
|
+
let rawAx;
|
|
295
|
+
let result;
|
|
296
|
+
let limitsEnabled = false;
|
|
297
|
+
let limitsMin = 0.0;
|
|
298
|
+
let limitsMax = 0.0;
|
|
299
|
+
switch (this.jointType) {
|
|
300
|
+
case JointType.Fixed:
|
|
301
|
+
let rawFra1 = RotationOps.intoRaw(this.frame1);
|
|
302
|
+
let rawFra2 = RotationOps.intoRaw(this.frame2);
|
|
303
|
+
result = RawGenericJoint.fixed(rawA1, rawFra1, rawA2, rawFra2);
|
|
304
|
+
rawFra1.free();
|
|
305
|
+
rawFra2.free();
|
|
306
|
+
break;
|
|
307
|
+
case JointType.Prismatic:
|
|
308
|
+
rawAx = VectorOps.intoRaw(this.axis);
|
|
309
|
+
if (!!this.limitsEnabled) {
|
|
310
|
+
limitsEnabled = true;
|
|
311
|
+
limitsMin = this.limits[0];
|
|
312
|
+
limitsMax = this.limits[1];
|
|
313
|
+
}
|
|
314
|
+
// #if DIM3
|
|
315
|
+
result = RawGenericJoint.prismatic(rawA1, rawA2, rawAx, limitsEnabled, limitsMin, limitsMax);
|
|
316
|
+
// #endif
|
|
317
|
+
rawAx.free();
|
|
318
|
+
break;
|
|
319
|
+
// #if DIM3
|
|
320
|
+
case JointType.Spherical:
|
|
321
|
+
result = RawGenericJoint.spherical(rawA1, rawA2);
|
|
322
|
+
break;
|
|
323
|
+
case JointType.Revolute:
|
|
324
|
+
rawAx = VectorOps.intoRaw(this.axis);
|
|
325
|
+
result = RawGenericJoint.revolute(rawA1, rawA2, rawAx);
|
|
326
|
+
rawAx.free();
|
|
327
|
+
break;
|
|
328
|
+
// #endif
|
|
329
|
+
}
|
|
330
|
+
rawA1.free();
|
|
331
|
+
rawA2.free();
|
|
332
|
+
return result;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
//# sourceMappingURL=impulse_joint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impulse_joint.js","sourceRoot":"","sources":["../src/dynamics/impulse_joint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,SAAS,EAAE,WAAW,EAAC,MAAM,SAAS,CAAC;AACjE,OAAO,EACH,eAAe,EAGf,YAAY,GACf,MAAM,QAAQ,CAAC;AAYhB;;;;;;;;;GASG;AACH,MAAM,CAAN,IAAY,SAOX;AAPD,WAAY,SAAS;IACjB,iDAAQ,CAAA;IACR,2CAAK,CAAA;IACL,mDAAS,CAAA;IACT,WAAW;IACX,mDAAS,CAAA;IACT,SAAS;AACb,CAAC,EAPW,SAAS,KAAT,SAAS,QAOpB;AAED,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,qEAAiB,CAAA;IACjB,uDAAU,CAAA;AACd,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB;AAED,MAAM,OAAO,YAAY;IAKrB,YACI,MAA0B,EAC1B,OAAqB,E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AM;YACV,KAAK,SAAS,CAAC,QAAQ;gBACnB,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACrC,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;gBACvD,KAAK,CAAC,IAAI,EAAE,CAAC;gBACb,MAAM;YACV,SAAS;SACZ;QAED,KAAK,CAAC,IAAI,EAAE,CAAC;QACb,KAAK,CAAC,IAAI,EAAE,CAAC;QAEb,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { RawImpulseJointSet } from "../raw";
|
|
2
|
+
import { RigidBodySet } from "./rigid_body_set";
|
|
3
|
+
import { ImpulseJoint, ImpulseJointHandle, 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 ImpulseJointSet {
|
|
12
|
+
raw: RawImpulseJointSet;
|
|
13
|
+
private map;
|
|
14
|
+
/**
|
|
15
|
+
* Release the WASM memory occupied by this joint set.
|
|
16
|
+
*/
|
|
17
|
+
free(): void;
|
|
18
|
+
constructor(raw?: RawImpulseJointSet);
|
|
19
|
+
/** @internal */
|
|
20
|
+
finalizeDeserialization(bodies: RigidBodySet): void;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new joint and return its integer handle.
|
|
23
|
+
*
|
|
24
|
+
* @param bodies - The set of rigid-bodies containing the bodies the joint is attached to.
|
|
25
|
+
* @param desc - The joint's parameters.
|
|
26
|
+
* @param parent1 - The handle of the first rigid-body this joint is attached to.
|
|
27
|
+
* @param parent2 - The handle of the second rigid-body this joint is attached to.
|
|
28
|
+
* @param wakeUp - Should the attached rigid-bodies be awakened?
|
|
29
|
+
*/
|
|
30
|
+
createJoint(bodies: RigidBodySet, desc: JointData, parent1: RigidBodyHandle, parent2: RigidBodyHandle, wakeUp: boolean): ImpulseJoint;
|
|
31
|
+
/**
|
|
32
|
+
* Remove a joint from this set.
|
|
33
|
+
*
|
|
34
|
+
* @param handle - The integer handle of the joint.
|
|
35
|
+
* @param wakeUp - If `true`, the rigid-bodies attached by the removed joint will be woken-up automatically.
|
|
36
|
+
*/
|
|
37
|
+
remove(handle: ImpulseJointHandle, wakeUp: boolean): void;
|
|
38
|
+
/**
|
|
39
|
+
* Calls the given closure with the integer handle of each impulse joint attached to this rigid-body.
|
|
40
|
+
*
|
|
41
|
+
* @param f - The closure called with the integer handle of each impulse joint attached to the rigid-body.
|
|
42
|
+
*/
|
|
43
|
+
forEachJointHandleAttachedToRigidBody(handle: RigidBodyHandle, f: (handle: ImpulseJointHandle) => void): void;
|
|
44
|
+
/**
|
|
45
|
+
* Internal function, do not call directly.
|
|
46
|
+
* @param handle
|
|
47
|
+
*/
|
|
48
|
+
unmap(handle: ImpulseJointHandle): void;
|
|
49
|
+
/**
|
|
50
|
+
* The number of joints on this set.
|
|
51
|
+
*/
|
|
52
|
+
len(): number;
|
|
53
|
+
/**
|
|
54
|
+
* Does this set contain a joint with the given handle?
|
|
55
|
+
*
|
|
56
|
+
* @param handle - The joint handle to check.
|
|
57
|
+
*/
|
|
58
|
+
contains(handle: ImpulseJointHandle): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Gets the joint with the given handle.
|
|
61
|
+
*
|
|
62
|
+
* Returns `null` if no joint with the specified handle exists.
|
|
63
|
+
*
|
|
64
|
+
* @param handle - The integer handle of the joint to retrieve.
|
|
65
|
+
*/
|
|
66
|
+
get(handle: ImpulseJointHandle): ImpulseJoint | null;
|
|
67
|
+
/**
|
|
68
|
+
* Applies the given closure to each joint contained by this set.
|
|
69
|
+
*
|
|
70
|
+
* @param f - The closure to apply.
|
|
71
|
+
*/
|
|
72
|
+
forEach(f: (joint: ImpulseJoint) => void): void;
|
|
73
|
+
/**
|
|
74
|
+
* Gets all joints in the list.
|
|
75
|
+
*
|
|
76
|
+
* @returns joint list.
|
|
77
|
+
*/
|
|
78
|
+
getAll(): ImpulseJoint[];
|
|
79
|
+
}
|