@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,240 @@
|
|
|
1
|
+
import { Vector } from "../math";
|
|
2
|
+
import { Collider, ColliderSet, InteractionGroups } from "../geometry";
|
|
3
|
+
import { QueryFilterFlags, QueryPipeline } 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 bodies;
|
|
11
|
+
private colliders;
|
|
12
|
+
private queries;
|
|
13
|
+
private _chassis;
|
|
14
|
+
constructor(chassis: RigidBody, bodies: RigidBodySet, colliders: ColliderSet, queries: QueryPipeline);
|
|
15
|
+
/** @internal */
|
|
16
|
+
free(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Updates the vehicle’s velocity based on its suspension, engine force, and brake.
|
|
19
|
+
*
|
|
20
|
+
* This directly updates the velocity of its chassis rigid-body.
|
|
21
|
+
*
|
|
22
|
+
* @param dt - Time increment used to integrate forces.
|
|
23
|
+
* @param filterFlags - Flag to exclude categories of objects from the wheels’ ray-cast.
|
|
24
|
+
* @param filterGroups - Only colliders compatible with these groups will be hit by the wheels’ ray-casts.
|
|
25
|
+
* @param filterPredicate - Callback to filter out which collider will be hit by the wheels’ ray-casts.
|
|
26
|
+
*/
|
|
27
|
+
updateVehicle(dt: number, filterFlags?: QueryFilterFlags, filterGroups?: InteractionGroups, filterPredicate?: (collider: Collider) => boolean): void;
|
|
28
|
+
/**
|
|
29
|
+
* The current forward speed of the vehicle.
|
|
30
|
+
*/
|
|
31
|
+
currentVehicleSpeed(): number;
|
|
32
|
+
/**
|
|
33
|
+
* The rigid-body used as the chassis.
|
|
34
|
+
*/
|
|
35
|
+
chassis(): RigidBody;
|
|
36
|
+
/**
|
|
37
|
+
* The chassis’ local _up_ direction (`0 = x, 1 = y, 2 = z`).
|
|
38
|
+
*/
|
|
39
|
+
get indexUpAxis(): number;
|
|
40
|
+
/**
|
|
41
|
+
* Sets the chassis’ local _up_ direction (`0 = x, 1 = y, 2 = z`).
|
|
42
|
+
*/
|
|
43
|
+
set indexUpAxis(axis: number);
|
|
44
|
+
/**
|
|
45
|
+
* The chassis’ local _forward_ direction (`0 = x, 1 = y, 2 = z`).
|
|
46
|
+
*/
|
|
47
|
+
get indexForwardAxis(): number;
|
|
48
|
+
/**
|
|
49
|
+
* Sets the chassis’ local _forward_ direction (`0 = x, 1 = y, 2 = z`).
|
|
50
|
+
*/
|
|
51
|
+
set setIndexForwardAxis(axis: number);
|
|
52
|
+
/**
|
|
53
|
+
* Adds a new wheel attached to this vehicle.
|
|
54
|
+
* @param chassisConnectionCs - The position of the wheel relative to the chassis.
|
|
55
|
+
* @param directionCs - The direction of the wheel’s suspension, relative to the chassis. The ray-casting will
|
|
56
|
+
* happen following this direction to detect the ground.
|
|
57
|
+
* @param axleCs - The wheel’s axle axis, relative to the chassis.
|
|
58
|
+
* @param suspensionRestLength - The rest length of the wheel’s suspension spring.
|
|
59
|
+
* @param radius - The wheel’s radius.
|
|
60
|
+
*/
|
|
61
|
+
addWheel(chassisConnectionCs: Vector, directionCs: Vector, axleCs: Vector, suspensionRestLength: number, radius: number): void;
|
|
62
|
+
/**
|
|
63
|
+
* The number of wheels attached to this vehicle.
|
|
64
|
+
*/
|
|
65
|
+
numWheels(): number;
|
|
66
|
+
/**
|
|
67
|
+
* The position of the i-th wheel, relative to the chassis.
|
|
68
|
+
*/
|
|
69
|
+
wheelChassisConnectionPointCs(i: number): Vector | null;
|
|
70
|
+
/**
|
|
71
|
+
* Sets the position of the i-th wheel, relative to the chassis.
|
|
72
|
+
*/
|
|
73
|
+
setWheelChassisConnectionPointCs(i: number, value: Vector): void;
|
|
74
|
+
/**
|
|
75
|
+
* The rest length of the i-th wheel’s suspension spring.
|
|
76
|
+
*/
|
|
77
|
+
wheelSuspensionRestLength(i: number): number | null;
|
|
78
|
+
/**
|
|
79
|
+
* Sets the rest length of the i-th wheel’s suspension spring.
|
|
80
|
+
*/
|
|
81
|
+
setWheelSuspensionRestLength(i: number, value: number): void;
|
|
82
|
+
/**
|
|
83
|
+
* The maximum distance the i-th wheel suspension can travel before and after its resting length.
|
|
84
|
+
*/
|
|
85
|
+
wheelMaxSuspensionTravel(i: number): number | null;
|
|
86
|
+
/**
|
|
87
|
+
* Sets the maximum distance the i-th wheel suspension can travel before and after its resting length.
|
|
88
|
+
*/
|
|
89
|
+
setWheelMaxSuspensionTravel(i: number, value: number): void;
|
|
90
|
+
/**
|
|
91
|
+
* The i-th wheel’s radius.
|
|
92
|
+
*/
|
|
93
|
+
wheelRadius(i: number): number | null;
|
|
94
|
+
/**
|
|
95
|
+
* Sets the i-th wheel’s radius.
|
|
96
|
+
*/
|
|
97
|
+
setWheelRadius(i: number, value: number): void;
|
|
98
|
+
/**
|
|
99
|
+
* The i-th wheel’s suspension stiffness.
|
|
100
|
+
*
|
|
101
|
+
* Increase this value if the suspension appears to not push the vehicle strong enough.
|
|
102
|
+
*/
|
|
103
|
+
wheelSuspensionStiffness(i: number): number | null;
|
|
104
|
+
/**
|
|
105
|
+
* Sets the i-th wheel’s suspension stiffness.
|
|
106
|
+
*
|
|
107
|
+
* Increase this value if the suspension appears to not push the vehicle strong enough.
|
|
108
|
+
*/
|
|
109
|
+
setWheelSuspensionStiffness(i: number, value: number): void;
|
|
110
|
+
/**
|
|
111
|
+
* The i-th wheel’s suspension’s damping when it is being compressed.
|
|
112
|
+
*/
|
|
113
|
+
wheelSuspensionCompression(i: number): number | null;
|
|
114
|
+
/**
|
|
115
|
+
* The i-th wheel’s suspension’s damping when it is being compressed.
|
|
116
|
+
*/
|
|
117
|
+
setWheelSuspensionCompression(i: number, value: number): void;
|
|
118
|
+
/**
|
|
119
|
+
* The i-th wheel’s suspension’s damping when it is being released.
|
|
120
|
+
*
|
|
121
|
+
* Increase this value if the suspension appears to overshoot.
|
|
122
|
+
*/
|
|
123
|
+
wheelSuspensionRelaxation(i: number): number | null;
|
|
124
|
+
/**
|
|
125
|
+
* Sets the i-th wheel’s suspension’s damping when it is being released.
|
|
126
|
+
*
|
|
127
|
+
* Increase this value if the suspension appears to overshoot.
|
|
128
|
+
*/
|
|
129
|
+
setWheelSuspensionRelaxation(i: number, value: number): void;
|
|
130
|
+
/**
|
|
131
|
+
* The maximum force applied by the i-th wheel’s suspension.
|
|
132
|
+
*/
|
|
133
|
+
wheelMaxSuspensionForce(i: number): number | null;
|
|
134
|
+
/**
|
|
135
|
+
* Sets the maximum force applied by the i-th wheel’s suspension.
|
|
136
|
+
*/
|
|
137
|
+
setWheelMaxSuspensionForce(i: number, value: number): void;
|
|
138
|
+
/**
|
|
139
|
+
* The maximum amount of braking impulse applied on the i-th wheel to slow down the vehicle.
|
|
140
|
+
*/
|
|
141
|
+
wheelBrake(i: number): number | null;
|
|
142
|
+
/**
|
|
143
|
+
* Set the maximum amount of braking impulse applied on the i-th wheel to slow down the vehicle.
|
|
144
|
+
*/
|
|
145
|
+
setWheelBrake(i: number, value: number): void;
|
|
146
|
+
/**
|
|
147
|
+
* The steering angle (radians) for the i-th wheel.
|
|
148
|
+
*/
|
|
149
|
+
wheelSteering(i: number): number | null;
|
|
150
|
+
/**
|
|
151
|
+
* Sets the steering angle (radians) for the i-th wheel.
|
|
152
|
+
*/
|
|
153
|
+
setWheelSteering(i: number, value: number): void;
|
|
154
|
+
/**
|
|
155
|
+
* The forward force applied by the i-th wheel on the chassis.
|
|
156
|
+
*/
|
|
157
|
+
wheelEngineForce(i: number): number | null;
|
|
158
|
+
/**
|
|
159
|
+
* Sets the forward force applied by the i-th wheel on the chassis.
|
|
160
|
+
*/
|
|
161
|
+
setWheelEngineForce(i: number, value: number): void;
|
|
162
|
+
/**
|
|
163
|
+
* The direction of the i-th wheel’s suspension, relative to the chassis.
|
|
164
|
+
*
|
|
165
|
+
* The ray-casting will happen following this direction to detect the ground.
|
|
166
|
+
*/
|
|
167
|
+
wheelDirectionCs(i: number): Vector | null;
|
|
168
|
+
/**
|
|
169
|
+
* Sets the direction of the i-th wheel’s suspension, relative to the chassis.
|
|
170
|
+
*
|
|
171
|
+
* The ray-casting will happen following this direction to detect the ground.
|
|
172
|
+
*/
|
|
173
|
+
setWheelDirectionCs(i: number, value: Vector): void;
|
|
174
|
+
/**
|
|
175
|
+
* The i-th wheel’s axle axis, relative to the chassis.
|
|
176
|
+
*
|
|
177
|
+
* The axis index defined as 0 = X, 1 = Y, 2 = Z.
|
|
178
|
+
*/
|
|
179
|
+
wheelAxleCs(i: number): Vector | null;
|
|
180
|
+
/**
|
|
181
|
+
* Sets the i-th wheel’s axle axis, relative to the chassis.
|
|
182
|
+
*
|
|
183
|
+
* The axis index defined as 0 = X, 1 = Y, 2 = Z.
|
|
184
|
+
*/
|
|
185
|
+
setWheelAxleCs(i: number, value: Vector): void;
|
|
186
|
+
/**
|
|
187
|
+
* Parameter controlling how much traction the tire has.
|
|
188
|
+
*
|
|
189
|
+
* The larger the value, the more instantaneous braking will happen (with the risk of
|
|
190
|
+
* causing the vehicle to flip if it’s too strong).
|
|
191
|
+
*/
|
|
192
|
+
wheelFrictionSlip(i: number): number | null;
|
|
193
|
+
/**
|
|
194
|
+
* Sets the parameter controlling how much traction the tire has.
|
|
195
|
+
*
|
|
196
|
+
* The larger the value, the more instantaneous braking will happen (with the risk of
|
|
197
|
+
* causing the vehicle to flip if it’s too strong).
|
|
198
|
+
*/
|
|
199
|
+
setWheelFrictionSlip(i: number, value: number): void;
|
|
200
|
+
/**
|
|
201
|
+
* The i-th wheel’s current rotation angle (radians) on its axle.
|
|
202
|
+
*/
|
|
203
|
+
wheelRotation(i: number): number | null;
|
|
204
|
+
/**
|
|
205
|
+
* The forward impulses applied by the i-th wheel on the chassis.
|
|
206
|
+
*/
|
|
207
|
+
wheelForwardImpulse(i: number): number | null;
|
|
208
|
+
/**
|
|
209
|
+
* The side impulses applied by the i-th wheel on the chassis.
|
|
210
|
+
*/
|
|
211
|
+
wheelSideImpulse(i: number): number | null;
|
|
212
|
+
/**
|
|
213
|
+
* The force applied by the i-th wheel suspension.
|
|
214
|
+
*/
|
|
215
|
+
wheelSuspensionForce(i: number): number | null;
|
|
216
|
+
/**
|
|
217
|
+
* The (world-space) contact normal between the i-th wheel and the floor.
|
|
218
|
+
*/
|
|
219
|
+
wheelContactNormal(i: number): Vector | null;
|
|
220
|
+
/**
|
|
221
|
+
* The (world-space) point hit by the wheel’s ray-cast for the i-th wheel.
|
|
222
|
+
*/
|
|
223
|
+
wheelContactPoint(i: number): Vector | null;
|
|
224
|
+
/**
|
|
225
|
+
* The suspension length for the i-th wheel.
|
|
226
|
+
*/
|
|
227
|
+
wheelSuspensionLength(i: number): number | null;
|
|
228
|
+
/**
|
|
229
|
+
* The (world-space) starting point of the ray-cast for the i-th wheel.
|
|
230
|
+
*/
|
|
231
|
+
wheelHardPoint(i: number): Vector | null;
|
|
232
|
+
/**
|
|
233
|
+
* Is the i-th wheel in contact with the ground?
|
|
234
|
+
*/
|
|
235
|
+
wheelIsInContact(i: number): boolean;
|
|
236
|
+
/**
|
|
237
|
+
* The collider hit by the ray-cast for the i-th wheel.
|
|
238
|
+
*/
|
|
239
|
+
wheelGroundObject(i: number): Collider | null;
|
|
240
|
+
}
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import { RawDynamicRayCastVehicleController } from "../raw";
|
|
2
|
+
import { VectorOps } from "../math";
|
|
3
|
+
/**
|
|
4
|
+
* A character controller to simulate vehicles using ray-casting for the wheels.
|
|
5
|
+
*/
|
|
6
|
+
export class DynamicRayCastVehicleController {
|
|
7
|
+
constructor(chassis, bodies, colliders, queries) {
|
|
8
|
+
this.raw = new RawDynamicRayCastVehicleController(chassis.handle);
|
|
9
|
+
this.bodies = bodies;
|
|
10
|
+
this.colliders = colliders;
|
|
11
|
+
this.queries = queries;
|
|
12
|
+
this._chassis = chassis;
|
|
13
|
+
}
|
|
14
|
+
/** @internal */
|
|
15
|
+
free() {
|
|
16
|
+
if (!!this.raw) {
|
|
17
|
+
this.raw.free();
|
|
18
|
+
}
|
|
19
|
+
this.raw = undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Updates the vehicle’s velocity based on its suspension, engine force, and brake.
|
|
23
|
+
*
|
|
24
|
+
* This directly updates the velocity of its chassis rigid-body.
|
|
25
|
+
*
|
|
26
|
+
* @param dt - Time increment used to integrate forces.
|
|
27
|
+
* @param filterFlags - Flag to exclude categories of objects from the wheels’ ray-cast.
|
|
28
|
+
* @param filterGroups - Only colliders compatible with these groups will be hit by the wheels’ ray-casts.
|
|
29
|
+
* @param filterPredicate - Callback to filter out which collider will be hit by the wheels’ ray-casts.
|
|
30
|
+
*/
|
|
31
|
+
updateVehicle(dt, filterFlags, filterGroups, filterPredicate) {
|
|
32
|
+
this.raw.update_vehicle(dt, this.bodies.raw, this.colliders.raw, this.queries.raw, filterFlags, filterGroups, this.colliders.castClosure(filterPredicate));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The current forward speed of the vehicle.
|
|
36
|
+
*/
|
|
37
|
+
currentVehicleSpeed() {
|
|
38
|
+
return this.raw.current_vehicle_speed();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The rigid-body used as the chassis.
|
|
42
|
+
*/
|
|
43
|
+
chassis() {
|
|
44
|
+
return this._chassis;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The chassis’ local _up_ direction (`0 = x, 1 = y, 2 = z`).
|
|
48
|
+
*/
|
|
49
|
+
get indexUpAxis() {
|
|
50
|
+
return this.raw.index_up_axis();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Sets the chassis’ local _up_ direction (`0 = x, 1 = y, 2 = z`).
|
|
54
|
+
*/
|
|
55
|
+
set indexUpAxis(axis) {
|
|
56
|
+
this.raw.set_index_up_axis(axis);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The chassis’ local _forward_ direction (`0 = x, 1 = y, 2 = z`).
|
|
60
|
+
*/
|
|
61
|
+
get indexForwardAxis() {
|
|
62
|
+
return this.raw.index_forward_axis();
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Sets the chassis’ local _forward_ direction (`0 = x, 1 = y, 2 = z`).
|
|
66
|
+
*/
|
|
67
|
+
set setIndexForwardAxis(axis) {
|
|
68
|
+
this.raw.set_index_forward_axis(axis);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Adds a new wheel attached to this vehicle.
|
|
72
|
+
* @param chassisConnectionCs - The position of the wheel relative to the chassis.
|
|
73
|
+
* @param directionCs - The direction of the wheel’s suspension, relative to the chassis. The ray-casting will
|
|
74
|
+
* happen following this direction to detect the ground.
|
|
75
|
+
* @param axleCs - The wheel’s axle axis, relative to the chassis.
|
|
76
|
+
* @param suspensionRestLength - The rest length of the wheel’s suspension spring.
|
|
77
|
+
* @param radius - The wheel’s radius.
|
|
78
|
+
*/
|
|
79
|
+
addWheel(chassisConnectionCs, directionCs, axleCs, suspensionRestLength, radius) {
|
|
80
|
+
let rawChassisConnectionCs = VectorOps.intoRaw(chassisConnectionCs);
|
|
81
|
+
let rawDirectionCs = VectorOps.intoRaw(directionCs);
|
|
82
|
+
let rawAxleCs = VectorOps.intoRaw(axleCs);
|
|
83
|
+
this.raw.add_wheel(rawChassisConnectionCs, rawDirectionCs, rawAxleCs, suspensionRestLength, radius);
|
|
84
|
+
rawChassisConnectionCs.free();
|
|
85
|
+
rawDirectionCs.free();
|
|
86
|
+
rawAxleCs.free();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The number of wheels attached to this vehicle.
|
|
90
|
+
*/
|
|
91
|
+
numWheels() {
|
|
92
|
+
return this.raw.num_wheels();
|
|
93
|
+
}
|
|
94
|
+
/*
|
|
95
|
+
*
|
|
96
|
+
* Access to wheel properties.
|
|
97
|
+
*
|
|
98
|
+
*/
|
|
99
|
+
/*
|
|
100
|
+
* Getters + setters
|
|
101
|
+
*/
|
|
102
|
+
/**
|
|
103
|
+
* The position of the i-th wheel, relative to the chassis.
|
|
104
|
+
*/
|
|
105
|
+
wheelChassisConnectionPointCs(i) {
|
|
106
|
+
return VectorOps.fromRaw(this.raw.wheel_chassis_connection_point_cs(i));
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Sets the position of the i-th wheel, relative to the chassis.
|
|
110
|
+
*/
|
|
111
|
+
setWheelChassisConnectionPointCs(i, value) {
|
|
112
|
+
let rawValue = VectorOps.intoRaw(value);
|
|
113
|
+
this.raw.set_wheel_chassis_connection_point_cs(i, rawValue);
|
|
114
|
+
rawValue.free();
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The rest length of the i-th wheel’s suspension spring.
|
|
118
|
+
*/
|
|
119
|
+
wheelSuspensionRestLength(i) {
|
|
120
|
+
return this.raw.wheel_suspension_rest_length(i);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Sets the rest length of the i-th wheel’s suspension spring.
|
|
124
|
+
*/
|
|
125
|
+
setWheelSuspensionRestLength(i, value) {
|
|
126
|
+
this.raw.set_wheel_suspension_rest_length(i, value);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The maximum distance the i-th wheel suspension can travel before and after its resting length.
|
|
130
|
+
*/
|
|
131
|
+
wheelMaxSuspensionTravel(i) {
|
|
132
|
+
return this.raw.wheel_max_suspension_travel(i);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Sets the maximum distance the i-th wheel suspension can travel before and after its resting length.
|
|
136
|
+
*/
|
|
137
|
+
setWheelMaxSuspensionTravel(i, value) {
|
|
138
|
+
this.raw.set_wheel_max_suspension_travel(i, value);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The i-th wheel’s radius.
|
|
142
|
+
*/
|
|
143
|
+
wheelRadius(i) {
|
|
144
|
+
return this.raw.wheel_radius(i);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Sets the i-th wheel’s radius.
|
|
148
|
+
*/
|
|
149
|
+
setWheelRadius(i, value) {
|
|
150
|
+
this.raw.set_wheel_radius(i, value);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* The i-th wheel’s suspension stiffness.
|
|
154
|
+
*
|
|
155
|
+
* Increase this value if the suspension appears to not push the vehicle strong enough.
|
|
156
|
+
*/
|
|
157
|
+
wheelSuspensionStiffness(i) {
|
|
158
|
+
return this.raw.wheel_suspension_stiffness(i);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Sets the i-th wheel’s suspension stiffness.
|
|
162
|
+
*
|
|
163
|
+
* Increase this value if the suspension appears to not push the vehicle strong enough.
|
|
164
|
+
*/
|
|
165
|
+
setWheelSuspensionStiffness(i, value) {
|
|
166
|
+
this.raw.set_wheel_suspension_stiffness(i, value);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The i-th wheel’s suspension’s damping when it is being compressed.
|
|
170
|
+
*/
|
|
171
|
+
wheelSuspensionCompression(i) {
|
|
172
|
+
return this.raw.wheel_suspension_compression(i);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The i-th wheel’s suspension’s damping when it is being compressed.
|
|
176
|
+
*/
|
|
177
|
+
setWheelSuspensionCompression(i, value) {
|
|
178
|
+
this.raw.set_wheel_suspension_compression(i, value);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The i-th wheel’s suspension’s damping when it is being released.
|
|
182
|
+
*
|
|
183
|
+
* Increase this value if the suspension appears to overshoot.
|
|
184
|
+
*/
|
|
185
|
+
wheelSuspensionRelaxation(i) {
|
|
186
|
+
return this.raw.wheel_suspension_relaxation(i);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Sets the i-th wheel’s suspension’s damping when it is being released.
|
|
190
|
+
*
|
|
191
|
+
* Increase this value if the suspension appears to overshoot.
|
|
192
|
+
*/
|
|
193
|
+
setWheelSuspensionRelaxation(i, value) {
|
|
194
|
+
this.raw.set_wheel_suspension_relaxation(i, value);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* The maximum force applied by the i-th wheel’s suspension.
|
|
198
|
+
*/
|
|
199
|
+
wheelMaxSuspensionForce(i) {
|
|
200
|
+
return this.raw.wheel_max_suspension_force(i);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Sets the maximum force applied by the i-th wheel’s suspension.
|
|
204
|
+
*/
|
|
205
|
+
setWheelMaxSuspensionForce(i, value) {
|
|
206
|
+
this.raw.set_wheel_max_suspension_force(i, value);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The maximum amount of braking impulse applied on the i-th wheel to slow down the vehicle.
|
|
210
|
+
*/
|
|
211
|
+
wheelBrake(i) {
|
|
212
|
+
return this.raw.wheel_brake(i);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Set the maximum amount of braking impulse applied on the i-th wheel to slow down the vehicle.
|
|
216
|
+
*/
|
|
217
|
+
setWheelBrake(i, value) {
|
|
218
|
+
this.raw.set_wheel_brake(i, value);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* The steering angle (radians) for the i-th wheel.
|
|
222
|
+
*/
|
|
223
|
+
wheelSteering(i) {
|
|
224
|
+
return this.raw.wheel_steering(i);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Sets the steering angle (radians) for the i-th wheel.
|
|
228
|
+
*/
|
|
229
|
+
setWheelSteering(i, value) {
|
|
230
|
+
this.raw.set_wheel_steering(i, value);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The forward force applied by the i-th wheel on the chassis.
|
|
234
|
+
*/
|
|
235
|
+
wheelEngineForce(i) {
|
|
236
|
+
return this.raw.wheel_engine_force(i);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Sets the forward force applied by the i-th wheel on the chassis.
|
|
240
|
+
*/
|
|
241
|
+
setWheelEngineForce(i, value) {
|
|
242
|
+
this.raw.set_wheel_engine_force(i, value);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The direction of the i-th wheel’s suspension, relative to the chassis.
|
|
246
|
+
*
|
|
247
|
+
* The ray-casting will happen following this direction to detect the ground.
|
|
248
|
+
*/
|
|
249
|
+
wheelDirectionCs(i) {
|
|
250
|
+
return VectorOps.fromRaw(this.raw.wheel_direction_cs(i));
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Sets the direction of the i-th wheel’s suspension, relative to the chassis.
|
|
254
|
+
*
|
|
255
|
+
* The ray-casting will happen following this direction to detect the ground.
|
|
256
|
+
*/
|
|
257
|
+
setWheelDirectionCs(i, value) {
|
|
258
|
+
let rawValue = VectorOps.intoRaw(value);
|
|
259
|
+
this.raw.set_wheel_direction_cs(i, rawValue);
|
|
260
|
+
rawValue.free();
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The i-th wheel’s axle axis, relative to the chassis.
|
|
264
|
+
*
|
|
265
|
+
* The axis index defined as 0 = X, 1 = Y, 2 = Z.
|
|
266
|
+
*/
|
|
267
|
+
wheelAxleCs(i) {
|
|
268
|
+
return VectorOps.fromRaw(this.raw.wheel_axle_cs(i));
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Sets the i-th wheel’s axle axis, relative to the chassis.
|
|
272
|
+
*
|
|
273
|
+
* The axis index defined as 0 = X, 1 = Y, 2 = Z.
|
|
274
|
+
*/
|
|
275
|
+
setWheelAxleCs(i, value) {
|
|
276
|
+
let rawValue = VectorOps.intoRaw(value);
|
|
277
|
+
this.raw.set_wheel_axle_cs(i, rawValue);
|
|
278
|
+
rawValue.free();
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Parameter controlling how much traction the tire has.
|
|
282
|
+
*
|
|
283
|
+
* The larger the value, the more instantaneous braking will happen (with the risk of
|
|
284
|
+
* causing the vehicle to flip if it’s too strong).
|
|
285
|
+
*/
|
|
286
|
+
wheelFrictionSlip(i) {
|
|
287
|
+
return this.raw.wheel_friction_slip(i);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Sets the parameter controlling how much traction the tire has.
|
|
291
|
+
*
|
|
292
|
+
* The larger the value, the more instantaneous braking will happen (with the risk of
|
|
293
|
+
* causing the vehicle to flip if it’s too strong).
|
|
294
|
+
*/
|
|
295
|
+
setWheelFrictionSlip(i, value) {
|
|
296
|
+
this.raw.set_wheel_friction_slip(i, value);
|
|
297
|
+
}
|
|
298
|
+
/*
|
|
299
|
+
* Getters only.
|
|
300
|
+
*/
|
|
301
|
+
/**
|
|
302
|
+
* The i-th wheel’s current rotation angle (radians) on its axle.
|
|
303
|
+
*/
|
|
304
|
+
wheelRotation(i) {
|
|
305
|
+
return this.raw.wheel_rotation(i);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* The forward impulses applied by the i-th wheel on the chassis.
|
|
309
|
+
*/
|
|
310
|
+
wheelForwardImpulse(i) {
|
|
311
|
+
return this.raw.wheel_forward_impulse(i);
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* The side impulses applied by the i-th wheel on the chassis.
|
|
315
|
+
*/
|
|
316
|
+
wheelSideImpulse(i) {
|
|
317
|
+
return this.raw.wheel_side_impulse(i);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* The force applied by the i-th wheel suspension.
|
|
321
|
+
*/
|
|
322
|
+
wheelSuspensionForce(i) {
|
|
323
|
+
return this.raw.wheel_suspension_force(i);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* The (world-space) contact normal between the i-th wheel and the floor.
|
|
327
|
+
*/
|
|
328
|
+
wheelContactNormal(i) {
|
|
329
|
+
return VectorOps.fromRaw(this.raw.wheel_contact_normal_ws(i));
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* The (world-space) point hit by the wheel’s ray-cast for the i-th wheel.
|
|
333
|
+
*/
|
|
334
|
+
wheelContactPoint(i) {
|
|
335
|
+
return VectorOps.fromRaw(this.raw.wheel_contact_point_ws(i));
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* The suspension length for the i-th wheel.
|
|
339
|
+
*/
|
|
340
|
+
wheelSuspensionLength(i) {
|
|
341
|
+
return this.raw.wheel_suspension_length(i);
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* The (world-space) starting point of the ray-cast for the i-th wheel.
|
|
345
|
+
*/
|
|
346
|
+
wheelHardPoint(i) {
|
|
347
|
+
return VectorOps.fromRaw(this.raw.wheel_hard_point_ws(i));
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Is the i-th wheel in contact with the ground?
|
|
351
|
+
*/
|
|
352
|
+
wheelIsInContact(i) {
|
|
353
|
+
return this.raw.wheel_is_in_contact(i);
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* The collider hit by the ray-cast for the i-th wheel.
|
|
357
|
+
*/
|
|
358
|
+
wheelGroundObject(i) {
|
|
359
|
+
return this.colliders.get(this.raw.wheel_ground_object(i));
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
//# sourceMappingURL=ray_cast_vehicle_controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ray_cast_vehicle_controller.js","sourceRoot":"","sources":["../src/control/ray_cast_vehicle_controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kCAAkC,EAAC,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAS,SAAS,EAAC,MAAM,SAAS,CAAC;AAK1C;;GAEG;AACH,MAAM,OAAO,+BAA+B;IAOxC,YACI,OAAkB,EAClB,MAAoB,EACpB,SAAsB,EACtB,OAAsB;QAEtB,IAAI,CAAC,GAAG,GAAG,IAAI,kCAAkC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAClE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAED,gBAAgB;IACT,IAAI;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sBAAsB,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,kBAAkB,CAAC,CAAS;QAC/B,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACI,iBAAiB,CAAC,CAAS;QAC9B,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACI,qBAAqB,CAAC,CAAS;QAClC,OAAO,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,CAAS;QAC3B,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACI,gBAAgB,CAAC,CAAS;QAC7B,OAAO,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACI,iBAAiB,CAAC,CAAS;QAC9B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;CACJ"}
|
|
@@ -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,22 @@
|
|
|
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 class CCDSolver {
|
|
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 RawCCDSolver();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ccd_solver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ccd_solver.js","sourceRoot":"","sources":["../src/dynamics/ccd_solver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,OAAO,SAAS;IAGlB;;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,GAAkB;QAC1B,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,IAAI,YAAY,EAAE,CAAC;IACzC,CAAC;CACJ"}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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 var CoefficientCombineRule;
|
|
9
|
+
(function (CoefficientCombineRule) {
|
|
10
|
+
CoefficientCombineRule[CoefficientCombineRule["Average"] = 0] = "Average";
|
|
11
|
+
CoefficientCombineRule[CoefficientCombineRule["Min"] = 1] = "Min";
|
|
12
|
+
CoefficientCombineRule[CoefficientCombineRule["Multiply"] = 2] = "Multiply";
|
|
13
|
+
CoefficientCombineRule[CoefficientCombineRule["Max"] = 3] = "Max";
|
|
14
|
+
})(CoefficientCombineRule || (CoefficientCombineRule = {}));
|
|
15
|
+
//# sourceMappingURL=coefficient_combine_rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coefficient_combine_rule.js","sourceRoot":"","sources":["../src/dynamics/coefficient_combine_rule.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAC9B,yEAAW,CAAA;IACX,iEAAO,CAAA;IACP,2EAAY,CAAA;IACZ,iEAAO,CAAA;AACX,CAAC,EALW,sBAAsB,KAAtB,sBAAsB,QAKjC"}
|