@absolutejs/rapier3d 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +85 -2
- package/dist/provenance.json +10 -0
- package/dist/rapier.mjs +1 -0
- package/dist/types/coarena.d.ts +15 -0
- package/dist/types/control/character_controller.d.ts +191 -0
- package/dist/types/control/index.d.ts +3 -0
- package/dist/types/control/pid_controller.d.ts +50 -0
- package/dist/types/control/ray_cast_vehicle_controller.d.ts +277 -0
- package/dist/types/dynamics/ccd_solver.d.ts +15 -0
- package/dist/types/dynamics/coefficient_combine_rule.d.ts +13 -0
- package/dist/types/dynamics/impulse_joint.d.ts +359 -0
- package/dist/types/dynamics/impulse_joint_set.d.ts +84 -0
- package/dist/types/dynamics/index.d.ts +12 -0
- package/dist/types/dynamics/integration_parameters.d.ts +109 -0
- package/dist/types/dynamics/island_manager.d.ts +24 -0
- package/dist/types/dynamics/multibody_joint.d.ts +42 -0
- package/dist/types/dynamics/multibody_joint_set.d.ts +81 -0
- package/dist/types/dynamics/rigid_body.d.ts +839 -0
- package/dist/types/dynamics/rigid_body_set.d.ts +90 -0
- package/dist/types/dynamics/soft_body.d.ts +1210 -0
- package/dist/types/dynamics/soft_body_set.d.ts +99 -0
- package/dist/types/exports.d.ts +8 -0
- package/dist/types/geometry/broad_phase.d.ts +162 -0
- package/dist/types/geometry/collider.d.ts +1016 -0
- package/dist/types/geometry/collider_set.d.ts +97 -0
- package/dist/types/geometry/contact.d.ts +36 -0
- package/dist/types/geometry/feature.d.ts +6 -0
- package/dist/types/geometry/index.d.ts +11 -0
- package/dist/types/geometry/interaction_groups.d.ts +18 -0
- package/dist/types/geometry/narrow_phase.d.ts +151 -0
- package/dist/types/geometry/point.d.ts +58 -0
- package/dist/types/geometry/ray.d.ts +108 -0
- package/dist/types/geometry/shape.d.ts +681 -0
- package/dist/types/geometry/toi.d.ts +59 -0
- package/dist/types/init.d.ts +3 -0
- package/dist/types/math.d.ts +98 -0
- package/dist/types/pipeline/debug_render_pipeline.d.ts +40 -0
- package/dist/types/pipeline/event_queue.d.ts +113 -0
- package/dist/types/pipeline/index.d.ts +7 -0
- package/dist/types/pipeline/physics_hooks.d.ts +39 -0
- package/dist/types/pipeline/physics_pipeline.d.ts +12 -0
- package/dist/types/pipeline/query_pipeline.d.ts +38 -0
- package/dist/types/pipeline/serialization_pipeline.d.ts +37 -0
- package/dist/types/pipeline/world.d.ts +674 -0
- package/dist/types/rapier.d.ts +3 -0
- package/dist/types/rapier_wasm3d.d.ts +2929 -0
- package/dist/types/raw.d.ts +1 -0
- package/package.json +33 -4
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class Coarena<T> {
|
|
2
|
+
fconv: Float64Array;
|
|
3
|
+
uconv: Uint32Array;
|
|
4
|
+
data: Array<T>;
|
|
5
|
+
size: number;
|
|
6
|
+
constructor();
|
|
7
|
+
set(handle: number, data: T): void;
|
|
8
|
+
len(): number;
|
|
9
|
+
delete(handle: number): void;
|
|
10
|
+
clear(): void;
|
|
11
|
+
get(handle: number): T | null;
|
|
12
|
+
forEach(f: (elt: T) => void): void;
|
|
13
|
+
getAll(): Array<T>;
|
|
14
|
+
private index;
|
|
15
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { Vector } from "../math";
|
|
2
|
+
import { BroadPhase, Collider, ColliderSet, InteractionGroups, NarrowPhase } from "../geometry";
|
|
3
|
+
import { QueryFilterFlags } from "../pipeline";
|
|
4
|
+
import { IntegrationParameters, RigidBodySet } from "../dynamics";
|
|
5
|
+
/**
|
|
6
|
+
* A collision between the character and an obstacle hit on its path.
|
|
7
|
+
*/
|
|
8
|
+
export declare class CharacterCollision {
|
|
9
|
+
/** The collider involved in the collision. Null if the collider no longer exists in the physics world. */
|
|
10
|
+
collider: Collider | null;
|
|
11
|
+
/** The translation delta applied to the character before this collision took place. */
|
|
12
|
+
translationDeltaApplied: Vector;
|
|
13
|
+
/** The translation delta the character would move after this collision if there is no other obstacles. */
|
|
14
|
+
translationDeltaRemaining: Vector;
|
|
15
|
+
/** The time-of-impact between the character and the obstacles. */
|
|
16
|
+
toi: number;
|
|
17
|
+
/** The world-space contact point on the collider when the collision happens. */
|
|
18
|
+
witness1: Vector;
|
|
19
|
+
/** The world-space contact point on the character when the collision happens. */
|
|
20
|
+
witness2: Vector;
|
|
21
|
+
/** The world-space outward contact normal on the collider when the collision happens. */
|
|
22
|
+
normal1: Vector;
|
|
23
|
+
/** The world-space outward contact normal on the character when the collision happens. */
|
|
24
|
+
normal2: Vector;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A character controller for controlling kinematic bodies and parentless colliders by hitting
|
|
28
|
+
* and sliding against obstacles.
|
|
29
|
+
*/
|
|
30
|
+
export declare class KinematicCharacterController {
|
|
31
|
+
private raw;
|
|
32
|
+
private rawCharacterCollision;
|
|
33
|
+
private params;
|
|
34
|
+
private broadPhase;
|
|
35
|
+
private narrowPhase;
|
|
36
|
+
private bodies;
|
|
37
|
+
private colliders;
|
|
38
|
+
private _applyImpulsesToDynamicBodies;
|
|
39
|
+
private _characterMass;
|
|
40
|
+
constructor(offset: number, params: IntegrationParameters, broadPhase: BroadPhase, narrowPhase: NarrowPhase, bodies: RigidBodySet, colliders: ColliderSet);
|
|
41
|
+
/** @internal */
|
|
42
|
+
free(): void;
|
|
43
|
+
/**
|
|
44
|
+
* The direction that goes "up". Used to determine where the floor is, and the floor’s angle.
|
|
45
|
+
*/
|
|
46
|
+
up(): Vector;
|
|
47
|
+
/**
|
|
48
|
+
* Sets the direction that goes "up". Used to determine where the floor is, and the floor’s angle.
|
|
49
|
+
*/
|
|
50
|
+
setUp(vector: Vector): void;
|
|
51
|
+
applyImpulsesToDynamicBodies(): boolean;
|
|
52
|
+
setApplyImpulsesToDynamicBodies(enabled: boolean): void;
|
|
53
|
+
/**
|
|
54
|
+
* Returns the custom value of the character mass, if it was set by `this.setCharacterMass`.
|
|
55
|
+
*/
|
|
56
|
+
characterMass(): number | null;
|
|
57
|
+
/**
|
|
58
|
+
* Set the mass of the character to be used for impulse resolution if `self.applyImpulsesToDynamicBodies`
|
|
59
|
+
* is set to `true`.
|
|
60
|
+
*
|
|
61
|
+
* If no character mass is set explicitly (or if it is set to `null`) it is automatically assumed to be equal
|
|
62
|
+
* to the mass of the rigid-body the character collider is attached to; or equal to 0 if the character collider
|
|
63
|
+
* isn’t attached to any rigid-body.
|
|
64
|
+
*
|
|
65
|
+
* @param mass - The mass to set.
|
|
66
|
+
*/
|
|
67
|
+
setCharacterMass(mass: number | null): void;
|
|
68
|
+
/**
|
|
69
|
+
* A small gap to preserve between the character and its surroundings.
|
|
70
|
+
*
|
|
71
|
+
* This value should not be too large to avoid visual artifacts, but shouldn’t be too small
|
|
72
|
+
* (must not be zero) to improve numerical stability of the character controller.
|
|
73
|
+
*/
|
|
74
|
+
offset(): number;
|
|
75
|
+
/**
|
|
76
|
+
* Sets a small gap to preserve between the character and its surroundings.
|
|
77
|
+
*
|
|
78
|
+
* This value should not be too large to avoid visual artifacts, but shouldn’t be too small
|
|
79
|
+
* (must not be zero) to improve numerical stability of the character controller.
|
|
80
|
+
*/
|
|
81
|
+
setOffset(value: number): void;
|
|
82
|
+
normalNudgeFactor(): number;
|
|
83
|
+
setNormalNudgeFactor(value: number): void;
|
|
84
|
+
/**
|
|
85
|
+
* Is sliding against obstacles enabled?
|
|
86
|
+
*/
|
|
87
|
+
slideEnabled(): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Enable or disable sliding against obstacles.
|
|
90
|
+
*/
|
|
91
|
+
setSlideEnabled(enabled: boolean): void;
|
|
92
|
+
/**
|
|
93
|
+
* The maximum step height a character can automatically step over.
|
|
94
|
+
*/
|
|
95
|
+
autostepMaxHeight(): number | null;
|
|
96
|
+
/**
|
|
97
|
+
* The minimum width of free space that must be available after stepping on a stair.
|
|
98
|
+
*/
|
|
99
|
+
autostepMinWidth(): number | null;
|
|
100
|
+
/**
|
|
101
|
+
* Can the character automatically step over dynamic bodies too?
|
|
102
|
+
*/
|
|
103
|
+
autostepIncludesDynamicBodies(): boolean | null;
|
|
104
|
+
/**
|
|
105
|
+
* Is automatically stepping over small objects enabled?
|
|
106
|
+
*/
|
|
107
|
+
autostepEnabled(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Enabled automatically stepping over small objects.
|
|
110
|
+
*
|
|
111
|
+
* @param maxHeight - The maximum step height a character can automatically step over.
|
|
112
|
+
* @param minWidth - The minimum width of free space that must be available after stepping on a stair.
|
|
113
|
+
* @param includeDynamicBodies - Can the character automatically step over dynamic bodies too?
|
|
114
|
+
*/
|
|
115
|
+
enableAutostep(maxHeight: number, minWidth: number, includeDynamicBodies: boolean): void;
|
|
116
|
+
/**
|
|
117
|
+
* Disable automatically stepping over small objects.
|
|
118
|
+
*/
|
|
119
|
+
disableAutostep(): void;
|
|
120
|
+
/**
|
|
121
|
+
* The maximum angle (radians) between the floor’s normal and the `up` vector that the
|
|
122
|
+
* character is able to climb.
|
|
123
|
+
*/
|
|
124
|
+
maxSlopeClimbAngle(): number;
|
|
125
|
+
/**
|
|
126
|
+
* Sets the maximum angle (radians) between the floor’s normal and the `up` vector that the
|
|
127
|
+
* character is able to climb.
|
|
128
|
+
*/
|
|
129
|
+
setMaxSlopeClimbAngle(angle: number): void;
|
|
130
|
+
/**
|
|
131
|
+
* The minimum angle (radians) between the floor’s normal and the `up` vector before the
|
|
132
|
+
* character starts to slide down automatically.
|
|
133
|
+
*/
|
|
134
|
+
minSlopeSlideAngle(): number;
|
|
135
|
+
/**
|
|
136
|
+
* Sets the minimum angle (radians) between the floor’s normal and the `up` vector before the
|
|
137
|
+
* character starts to slide down automatically.
|
|
138
|
+
*/
|
|
139
|
+
setMinSlopeSlideAngle(angle: number): void;
|
|
140
|
+
/**
|
|
141
|
+
* If snap-to-ground is enabled, should the character be automatically snapped to the ground if
|
|
142
|
+
* the distance between the ground and its feet are smaller than the specified threshold?
|
|
143
|
+
*/
|
|
144
|
+
snapToGroundDistance(): number | null;
|
|
145
|
+
/**
|
|
146
|
+
* Enables automatically snapping the character to the ground if the distance between
|
|
147
|
+
* the ground and its feet are smaller than the specified threshold.
|
|
148
|
+
*/
|
|
149
|
+
enableSnapToGround(distance: number): void;
|
|
150
|
+
/**
|
|
151
|
+
* Disables automatically snapping the character to the ground.
|
|
152
|
+
*/
|
|
153
|
+
disableSnapToGround(): void;
|
|
154
|
+
/**
|
|
155
|
+
* Is automatically snapping the character to the ground enabled?
|
|
156
|
+
*/
|
|
157
|
+
snapToGroundEnabled(): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Computes the movement the given collider is able to execute after hitting and sliding on obstacles.
|
|
160
|
+
*
|
|
161
|
+
* @param collider - The collider to move.
|
|
162
|
+
* @param desiredTranslationDelta - The desired collider movement.
|
|
163
|
+
* @param filterFlags - Flags for excluding whole subsets of colliders from the obstacles taken into account.
|
|
164
|
+
* @param filterGroups - Groups for excluding colliders with incompatible collision groups from the obstacles
|
|
165
|
+
* taken into account.
|
|
166
|
+
* @param filterPredicate - Any collider for which this closure returns `false` will be excluded from the
|
|
167
|
+
* obstacles taken into account.
|
|
168
|
+
*/
|
|
169
|
+
computeColliderMovement(collider: Collider, desiredTranslationDelta: Vector, filterFlags?: QueryFilterFlags, filterGroups?: InteractionGroups, filterPredicate?: (collider: Collider) => boolean): void;
|
|
170
|
+
/**
|
|
171
|
+
* The movement computed by the last call to `this.computeColliderMovement`.
|
|
172
|
+
*/
|
|
173
|
+
computedMovement(target?: Vector): Vector;
|
|
174
|
+
/**
|
|
175
|
+
* The result of ground detection computed by the last call to `this.computeColliderMovement`.
|
|
176
|
+
*/
|
|
177
|
+
computedGrounded(): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* The number of collisions against obstacles detected along the path of the last call
|
|
180
|
+
* to `this.computeColliderMovement`.
|
|
181
|
+
*/
|
|
182
|
+
numComputedCollisions(): number;
|
|
183
|
+
/**
|
|
184
|
+
* Returns the collision against one of the obstacles detected along the path of the last
|
|
185
|
+
* call to `this.computeColliderMovement`.
|
|
186
|
+
*
|
|
187
|
+
* @param i - The i-th collision will be returned.
|
|
188
|
+
* @param out - If this argument is set, it will be filled with the collision information.
|
|
189
|
+
*/
|
|
190
|
+
computedCollision(i: number, out?: CharacterCollision): CharacterCollision | null;
|
|
191
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Rotation, Vector } from "../math";
|
|
2
|
+
import { IntegrationParameters, RigidBody, RigidBodySet } from "../dynamics";
|
|
3
|
+
/**
|
|
4
|
+
* An enum representing the possible joint axes controlled by a PidController.
|
|
5
|
+
* They can be ORed together, like:
|
|
6
|
+
* PidAxesMask.LinX || PidAxesMask.LinY
|
|
7
|
+
* to get a pid controller that only constraints the translational X and Y axes.
|
|
8
|
+
*
|
|
9
|
+
* Possible axes are:
|
|
10
|
+
*
|
|
11
|
+
* - `X`: X translation axis
|
|
12
|
+
* - `Y`: Y translation axis
|
|
13
|
+
* - `Z`: Z translation axis
|
|
14
|
+
* - `AngX`: X angular rotation axis (3D only)
|
|
15
|
+
* - `AngY`: Y angular rotation axis (3D only)
|
|
16
|
+
* - `AngZ`: Z angular rotation axis
|
|
17
|
+
*/
|
|
18
|
+
export declare enum PidAxesMask {
|
|
19
|
+
None = 0,
|
|
20
|
+
LinX = 1,
|
|
21
|
+
LinY = 2,
|
|
22
|
+
LinZ = 4,
|
|
23
|
+
AngX = 8,
|
|
24
|
+
AngY = 16,
|
|
25
|
+
AngZ = 32,
|
|
26
|
+
AllLin = 7,
|
|
27
|
+
AllAng = 56,
|
|
28
|
+
All = 63
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A controller for controlling dynamic bodies using the
|
|
32
|
+
* Proportional-Integral-Derivative correction model.
|
|
33
|
+
*/
|
|
34
|
+
export declare class PidController {
|
|
35
|
+
private raw;
|
|
36
|
+
private params;
|
|
37
|
+
private bodies;
|
|
38
|
+
constructor(params: IntegrationParameters, bodies: RigidBodySet, kp: number, ki: number, kd: number, axes: PidAxesMask);
|
|
39
|
+
/** @internal */
|
|
40
|
+
free(): void;
|
|
41
|
+
setKp(kp: number, axes: PidAxesMask): void;
|
|
42
|
+
setKi(ki: number, axes: PidAxesMask): void;
|
|
43
|
+
setKd(kd: number, axes: PidAxesMask): void;
|
|
44
|
+
setAxes(axes: PidAxesMask): void;
|
|
45
|
+
resetIntegrals(): void;
|
|
46
|
+
applyLinearCorrection(body: RigidBody, targetPosition: Vector, targetLinvel: Vector): void;
|
|
47
|
+
applyAngularCorrection(body: RigidBody, targetRotation: Rotation, targetAngVel: Vector): void;
|
|
48
|
+
linearCorrection(body: RigidBody, targetPosition: Vector, targetLinvel: Vector, target?: Vector): Vector;
|
|
49
|
+
angularCorrection(body: RigidBody, targetRotation: Rotation, targetAngVel: Vector, target?: Vector): Vector;
|
|
50
|
+
}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { Vector } from "../math";
|
|
2
|
+
import { BroadPhase, Collider, ColliderSet, InteractionGroups, NarrowPhase } from "../geometry";
|
|
3
|
+
import { QueryFilterFlags } from "../pipeline";
|
|
4
|
+
import { RigidBody, RigidBodySet } from "../dynamics";
|
|
5
|
+
/**
|
|
6
|
+
* A character controller to simulate vehicles using ray-casting for the wheels.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DynamicRayCastVehicleController {
|
|
9
|
+
private raw;
|
|
10
|
+
private broadPhase;
|
|
11
|
+
private narrowPhase;
|
|
12
|
+
private bodies;
|
|
13
|
+
private colliders;
|
|
14
|
+
private _chassis;
|
|
15
|
+
constructor(chassis: RigidBody, broadPhase: BroadPhase, narrowPhase: NarrowPhase, bodies: RigidBodySet, colliders: ColliderSet);
|
|
16
|
+
/** @internal */
|
|
17
|
+
free(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Updates the vehicle’s velocity based on its suspension, engine force, and brake.
|
|
20
|
+
*
|
|
21
|
+
* This directly updates the velocity of its chassis rigid-body.
|
|
22
|
+
*
|
|
23
|
+
* @param dt - Time increment used to integrate forces.
|
|
24
|
+
* @param filterFlags - Flag to exclude categories of objects from the wheels’ ray-cast.
|
|
25
|
+
* @param filterGroups - Only colliders compatible with these groups will be hit by the wheels’ ray-casts.
|
|
26
|
+
* @param filterPredicate - Callback to filter out which collider will be hit by the wheels’ ray-casts.
|
|
27
|
+
*/
|
|
28
|
+
updateVehicle(dt: number, filterFlags?: QueryFilterFlags, filterGroups?: InteractionGroups, filterPredicate?: (collider: Collider) => boolean): void;
|
|
29
|
+
/**
|
|
30
|
+
* The current forward speed of the vehicle.
|
|
31
|
+
*/
|
|
32
|
+
currentVehicleSpeed(): number;
|
|
33
|
+
/**
|
|
34
|
+
* The rigid-body used as the chassis.
|
|
35
|
+
*/
|
|
36
|
+
chassis(): RigidBody;
|
|
37
|
+
/**
|
|
38
|
+
* The chassis’ local _up_ direction (`0 = x, 1 = y, 2 = z`).
|
|
39
|
+
*/
|
|
40
|
+
get indexUpAxis(): number;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the chassis’ local _up_ direction (`0 = x, 1 = y, 2 = z`).
|
|
43
|
+
*/
|
|
44
|
+
set indexUpAxis(axis: number);
|
|
45
|
+
/**
|
|
46
|
+
* The chassis’ local _forward_ direction (`0 = x, 1 = y, 2 = z`).
|
|
47
|
+
*/
|
|
48
|
+
get indexForwardAxis(): number;
|
|
49
|
+
/**
|
|
50
|
+
* Sets the chassis’ local _forward_ direction (`0 = x, 1 = y, 2 = z`).
|
|
51
|
+
*/
|
|
52
|
+
set setIndexForwardAxis(axis: number);
|
|
53
|
+
/**
|
|
54
|
+
* Adds a new wheel attached to this vehicle.
|
|
55
|
+
* @param chassisConnectionCs - The position of the wheel relative to the chassis.
|
|
56
|
+
* @param directionCs - The direction of the wheel’s suspension, relative to the chassis. The ray-casting will
|
|
57
|
+
* happen following this direction to detect the ground.
|
|
58
|
+
* @param axleCs - The wheel’s axle axis, relative to the chassis.
|
|
59
|
+
* @param suspensionRestLength - The rest length of the wheel’s suspension spring.
|
|
60
|
+
* @param radius - The wheel’s radius.
|
|
61
|
+
*/
|
|
62
|
+
addWheel(chassisConnectionCs: Vector, directionCs: Vector, axleCs: Vector, suspensionRestLength: number, radius: number): void;
|
|
63
|
+
/**
|
|
64
|
+
* The number of wheels attached to this vehicle.
|
|
65
|
+
*/
|
|
66
|
+
numWheels(): number;
|
|
67
|
+
/**
|
|
68
|
+
* The position of the i-th wheel, relative to the chassis.
|
|
69
|
+
*
|
|
70
|
+
* @param {number} i
|
|
71
|
+
* @param {Vector?} target - The object to be populated. If provided,
|
|
72
|
+
* the function returns this object instead of creating a new one.
|
|
73
|
+
*/
|
|
74
|
+
wheelChassisConnectionPointCs(i: number, target?: Vector): Vector | null;
|
|
75
|
+
/**
|
|
76
|
+
* Sets the position of the i-th wheel, relative to the chassis.
|
|
77
|
+
*/
|
|
78
|
+
setWheelChassisConnectionPointCs(i: number, value: Vector): void;
|
|
79
|
+
/**
|
|
80
|
+
* The rest length of the i-th wheel’s suspension spring.
|
|
81
|
+
*/
|
|
82
|
+
wheelSuspensionRestLength(i: number): number | null;
|
|
83
|
+
/**
|
|
84
|
+
* Sets the rest length of the i-th wheel’s suspension spring.
|
|
85
|
+
*/
|
|
86
|
+
setWheelSuspensionRestLength(i: number, value: number): void;
|
|
87
|
+
/**
|
|
88
|
+
* The maximum distance the i-th wheel suspension can travel before and after its resting length.
|
|
89
|
+
*/
|
|
90
|
+
wheelMaxSuspensionTravel(i: number): number | null;
|
|
91
|
+
/**
|
|
92
|
+
* Sets the maximum distance the i-th wheel suspension can travel before and after its resting length.
|
|
93
|
+
*/
|
|
94
|
+
setWheelMaxSuspensionTravel(i: number, value: number): void;
|
|
95
|
+
/**
|
|
96
|
+
* The i-th wheel’s radius.
|
|
97
|
+
*/
|
|
98
|
+
wheelRadius(i: number): number | null;
|
|
99
|
+
/**
|
|
100
|
+
* Sets the i-th wheel’s radius.
|
|
101
|
+
*/
|
|
102
|
+
setWheelRadius(i: number, value: number): void;
|
|
103
|
+
/**
|
|
104
|
+
* The i-th wheel’s suspension stiffness.
|
|
105
|
+
*
|
|
106
|
+
* Increase this value if the suspension appears to not push the vehicle strong enough.
|
|
107
|
+
*/
|
|
108
|
+
wheelSuspensionStiffness(i: number): number | null;
|
|
109
|
+
/**
|
|
110
|
+
* Sets the i-th wheel’s suspension stiffness.
|
|
111
|
+
*
|
|
112
|
+
* Increase this value if the suspension appears to not push the vehicle strong enough.
|
|
113
|
+
*/
|
|
114
|
+
setWheelSuspensionStiffness(i: number, value: number): void;
|
|
115
|
+
/**
|
|
116
|
+
* The i-th wheel’s suspension’s damping when it is being compressed.
|
|
117
|
+
*/
|
|
118
|
+
wheelSuspensionCompression(i: number): number | null;
|
|
119
|
+
/**
|
|
120
|
+
* The i-th wheel’s suspension’s damping when it is being compressed.
|
|
121
|
+
*/
|
|
122
|
+
setWheelSuspensionCompression(i: number, value: number): void;
|
|
123
|
+
/**
|
|
124
|
+
* The i-th wheel’s suspension’s damping when it is being released.
|
|
125
|
+
*
|
|
126
|
+
* Increase this value if the suspension appears to overshoot.
|
|
127
|
+
*/
|
|
128
|
+
wheelSuspensionRelaxation(i: number): number | null;
|
|
129
|
+
/**
|
|
130
|
+
* Sets the i-th wheel’s suspension’s damping when it is being released.
|
|
131
|
+
*
|
|
132
|
+
* Increase this value if the suspension appears to overshoot.
|
|
133
|
+
*/
|
|
134
|
+
setWheelSuspensionRelaxation(i: number, value: number): void;
|
|
135
|
+
/**
|
|
136
|
+
* The maximum force applied by the i-th wheel’s suspension.
|
|
137
|
+
*/
|
|
138
|
+
wheelMaxSuspensionForce(i: number): number | null;
|
|
139
|
+
/**
|
|
140
|
+
* Sets the maximum force applied by the i-th wheel’s suspension.
|
|
141
|
+
*/
|
|
142
|
+
setWheelMaxSuspensionForce(i: number, value: number): void;
|
|
143
|
+
/**
|
|
144
|
+
* The maximum amount of braking impulse applied on the i-th wheel to slow down the vehicle.
|
|
145
|
+
*/
|
|
146
|
+
wheelBrake(i: number): number | null;
|
|
147
|
+
/**
|
|
148
|
+
* Set the maximum amount of braking impulse applied on the i-th wheel to slow down the vehicle.
|
|
149
|
+
*/
|
|
150
|
+
setWheelBrake(i: number, value: number): void;
|
|
151
|
+
/**
|
|
152
|
+
* The steering angle (radians) for the i-th wheel.
|
|
153
|
+
*/
|
|
154
|
+
wheelSteering(i: number): number | null;
|
|
155
|
+
/**
|
|
156
|
+
* Sets the steering angle (radians) for the i-th wheel.
|
|
157
|
+
*/
|
|
158
|
+
setWheelSteering(i: number, value: number): void;
|
|
159
|
+
/**
|
|
160
|
+
* The forward force applied by the i-th wheel on the chassis.
|
|
161
|
+
*/
|
|
162
|
+
wheelEngineForce(i: number): number | null;
|
|
163
|
+
/**
|
|
164
|
+
* Sets the forward force applied by the i-th wheel on the chassis.
|
|
165
|
+
*/
|
|
166
|
+
setWheelEngineForce(i: number, value: number): void;
|
|
167
|
+
/**
|
|
168
|
+
* The direction of the i-th wheel’s suspension, relative to the chassis.
|
|
169
|
+
*
|
|
170
|
+
* The ray-casting will happen following this direction to detect the ground.
|
|
171
|
+
*
|
|
172
|
+
* @param {number} i
|
|
173
|
+
* @param {Vector?} target - The object to be populated. If provided,
|
|
174
|
+
* the function returns this object instead of creating a new one.
|
|
175
|
+
*/
|
|
176
|
+
wheelDirectionCs(i: number, target?: Vector): Vector | null;
|
|
177
|
+
/**
|
|
178
|
+
* Sets the direction of the i-th wheel’s suspension, relative to the chassis.
|
|
179
|
+
*
|
|
180
|
+
* The ray-casting will happen following this direction to detect the ground.
|
|
181
|
+
*/
|
|
182
|
+
setWheelDirectionCs(i: number, value: Vector): void;
|
|
183
|
+
/**
|
|
184
|
+
* The i-th wheel’s axle axis, relative to the chassis.
|
|
185
|
+
*
|
|
186
|
+
* The axis index defined as 0 = X, 1 = Y, 2 = Z.
|
|
187
|
+
*
|
|
188
|
+
* @param {number} i
|
|
189
|
+
* @param {Vector?} target - The object to be populated. If provided,
|
|
190
|
+
* the function returns this object instead of creating a new one.
|
|
191
|
+
*/
|
|
192
|
+
wheelAxleCs(i: number, target?: Vector): Vector | null;
|
|
193
|
+
/**
|
|
194
|
+
* Sets the i-th wheel’s axle axis, relative to the chassis.
|
|
195
|
+
*
|
|
196
|
+
* The axis index defined as 0 = X, 1 = Y, 2 = Z.
|
|
197
|
+
*/
|
|
198
|
+
setWheelAxleCs(i: number, value: Vector): void;
|
|
199
|
+
/**
|
|
200
|
+
* Parameter controlling how much traction the tire has.
|
|
201
|
+
*
|
|
202
|
+
* The larger the value, the more instantaneous braking will happen (with the risk of
|
|
203
|
+
* causing the vehicle to flip if it’s too strong).
|
|
204
|
+
*/
|
|
205
|
+
wheelFrictionSlip(i: number): number | null;
|
|
206
|
+
/**
|
|
207
|
+
* Sets the parameter controlling how much traction the tire has.
|
|
208
|
+
*
|
|
209
|
+
* The larger the value, the more instantaneous braking will happen (with the risk of
|
|
210
|
+
* causing the vehicle to flip if it’s too strong).
|
|
211
|
+
*/
|
|
212
|
+
setWheelFrictionSlip(i: number, value: number): void;
|
|
213
|
+
/**
|
|
214
|
+
* The multiplier of friction between a tire and the collider it’s on top of.
|
|
215
|
+
*
|
|
216
|
+
* The larger the value, the stronger side friction will be.
|
|
217
|
+
*/
|
|
218
|
+
wheelSideFrictionStiffness(i: number): number | null;
|
|
219
|
+
/**
|
|
220
|
+
* The multiplier of friction between a tire and the collider it’s on top of.
|
|
221
|
+
*
|
|
222
|
+
* The larger the value, the stronger side friction will be.
|
|
223
|
+
*/
|
|
224
|
+
setWheelSideFrictionStiffness(i: number, value: number): void;
|
|
225
|
+
/**
|
|
226
|
+
* The i-th wheel’s current rotation angle (radians) on its axle.
|
|
227
|
+
*/
|
|
228
|
+
wheelRotation(i: number): number | null;
|
|
229
|
+
/**
|
|
230
|
+
* The forward impulses applied by the i-th wheel on the chassis.
|
|
231
|
+
*/
|
|
232
|
+
wheelForwardImpulse(i: number): number | null;
|
|
233
|
+
/**
|
|
234
|
+
* The side impulses applied by the i-th wheel on the chassis.
|
|
235
|
+
*/
|
|
236
|
+
wheelSideImpulse(i: number): number | null;
|
|
237
|
+
/**
|
|
238
|
+
* The force applied by the i-th wheel suspension.
|
|
239
|
+
*/
|
|
240
|
+
wheelSuspensionForce(i: number): number | null;
|
|
241
|
+
/**
|
|
242
|
+
* The (world-space) contact normal between the i-th wheel and the floor.
|
|
243
|
+
*
|
|
244
|
+
* @param {number} i
|
|
245
|
+
* @param {Vector?} target - The object to be populated. If provided,
|
|
246
|
+
* the function returns this object instead of creating a new one.
|
|
247
|
+
*/
|
|
248
|
+
wheelContactNormal(i: number, target?: Vector): Vector | null;
|
|
249
|
+
/**
|
|
250
|
+
* The (world-space) point hit by the wheel’s ray-cast for the i-th wheel.
|
|
251
|
+
*
|
|
252
|
+
* @param {number} i
|
|
253
|
+
* @param {Vector?} target - The object to be populated. If provided,
|
|
254
|
+
* the function returns this object instead of creating a new one.
|
|
255
|
+
*/
|
|
256
|
+
wheelContactPoint(i: number, target?: Vector): Vector | null;
|
|
257
|
+
/**
|
|
258
|
+
* The suspension length for the i-th wheel.
|
|
259
|
+
*/
|
|
260
|
+
wheelSuspensionLength(i: number): number | null;
|
|
261
|
+
/**
|
|
262
|
+
* The (world-space) starting point of the ray-cast for the i-th wheel.
|
|
263
|
+
*
|
|
264
|
+
* @param {number} i
|
|
265
|
+
* @param {Vector?} target - The object to be populated. If provided,
|
|
266
|
+
* the function returns this object instead of creating a new one.
|
|
267
|
+
*/
|
|
268
|
+
wheelHardPoint(i: number, target?: Vector): Vector | null;
|
|
269
|
+
/**
|
|
270
|
+
* Is the i-th wheel in contact with the ground?
|
|
271
|
+
*/
|
|
272
|
+
wheelIsInContact(i: number): boolean;
|
|
273
|
+
/**
|
|
274
|
+
* The collider hit by the ray-cast for the i-th wheel.
|
|
275
|
+
*/
|
|
276
|
+
wheelGroundObject(i: number): Collider | null;
|
|
277
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RawCCDSolver } 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 declare class CCDSolver {
|
|
9
|
+
raw: RawCCDSolver;
|
|
10
|
+
/**
|
|
11
|
+
* Release the WASM memory occupied by this narrow-phase.
|
|
12
|
+
*/
|
|
13
|
+
free(): void;
|
|
14
|
+
constructor(raw?: RawCCDSolver);
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A rule applied to combine coefficients.
|
|
3
|
+
*
|
|
4
|
+
* Use this when configuring the `ColliderDesc` to specify
|
|
5
|
+
* how friction and restitution coefficient should be combined
|
|
6
|
+
* in a contact.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum CoefficientCombineRule {
|
|
9
|
+
Average = 0,
|
|
10
|
+
Min = 1,
|
|
11
|
+
Multiply = 2,
|
|
12
|
+
Max = 3
|
|
13
|
+
}
|