Skip to content

Commit 6277764

Browse files
authored
Release v0.18.0-beta.0 (#335)
* feat: un-deprecate collider properties accessors * feat: add functions for getting a collider’s translation/rotation wrt. its parent rigid-body * Update to rapier 0.27.0-beta.0 * Release v0.18.0-beta.0 * chore: run prettier
1 parent 24c3187 commit 6277764

19 files changed

+1181
-1032
lines changed

CHANGELOG.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1-
### Unreleased
1+
### 0.18.0-beta.0 (12 July 2025)
2+
3+
#### Modified
4+
5+
- Update to Rapier 0.22.0-beta.1 which includes a fully reworked narrow-phase tha supports scene queries.
6+
This implies a performance gain on large scenes by avoiding the need to re-build the underlying acceleration
7+
structure at each frame.
8+
- Un-deprecate methods for reading shape properties (for example `collider.radius()`). It turned out that these
9+
methods are more convenient as they are guaranteed to always be in sync with rapier’s state on wasm.
10+
- Add `collider.translationWrtParent()` and `collider.rotationWrtParent()` to get the collider’s transaltion/rotation
11+
relative to its parent rigid-body.
212

313
#### Fix
414

5-
- rapier-compat top level javascript files extensions have been changed from `.cjs.js` and `.es.js` to `.cjs` and `mjs` respectively. This results in better compatibility with NPM.
15+
- rapier-compat top level javascript files extensions have been changed from `.cjs.js` and `.es.js` to `.cjs` and `mjs`
16+
respectively. This results in better compatibility with NPM.
617

718
### 0.17.3 (30 May 2025)
819

Cargo.lock

Lines changed: 51 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

builds/prepare_builds/templates/Cargo.toml.tera

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dimforge_{{ js_package_name }}" # Can't be named rapier{{ dimension }}d which conflicts with the dependency.
3-
version = "0.17.3"
3+
version = "0.18.0-beta.0"
44
authors = ["Sébastien Crozet <[email protected]>"]
55
description = "{{ dimension }}-dimensional physics engine in Rust - official JS bindings."
66
documentation = "https://rapier.rs/rustdoc/rapier{{ dimension }}d/index.html"
@@ -27,7 +27,7 @@ rust.unexpected_cfgs = { level = "warn", check-cfg = [
2727
] }
2828

2929
[dependencies]
30-
rapier{{ dimension }}d = { version = "0.26.1", features = [
30+
rapier{{ dimension }}d = { version = "0.27.0-beta.0", features = [
3131
"serde-serialize",
3232
"debug-render",
3333
{%- for feature in additional_features %}

src.ts/control/character_controller.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import {RawKinematicCharacterController, RawCharacterCollision} from "../raw";
22
import {Rotation, Vector, VectorOps} from "../math";
3-
import {Collider, ColliderSet, InteractionGroups, Shape} from "../geometry";
4-
import {QueryFilterFlags, QueryPipeline, World} from "../pipeline";
3+
import {
4+
BroadPhase,
5+
Collider,
6+
ColliderSet,
7+
InteractionGroups,
8+
NarrowPhase,
9+
Shape,
10+
} from "../geometry";
11+
import {QueryFilterFlags, World} from "../pipeline";
512
import {IntegrationParameters, RigidBody, RigidBodySet} from "../dynamics";
613

714
/**
@@ -35,23 +42,26 @@ export class KinematicCharacterController {
3542
private rawCharacterCollision: RawCharacterCollision;
3643

3744
private params: IntegrationParameters;
45+
private broadPhase: BroadPhase;
46+
private narrowPhase: NarrowPhase;
3847
private bodies: RigidBodySet;
3948
private colliders: ColliderSet;
40-
private queries: QueryPipeline;
4149
private _applyImpulsesToDynamicBodies: boolean;
4250
private _characterMass: number | null;
4351

4452
constructor(
4553
offset: number,
4654
params: IntegrationParameters,
55+
broadPhase: BroadPhase,
56+
narrowPhase: NarrowPhase,
4757
bodies: RigidBodySet,
4858
colliders: ColliderSet,
49-
queries: QueryPipeline,
5059
) {
5160
this.params = params;
5261
this.bodies = bodies;
5362
this.colliders = colliders;
54-
this.queries = queries;
63+
this.broadPhase = broadPhase;
64+
this.narrowPhase = narrowPhase;
5565
this.raw = new RawKinematicCharacterController(offset);
5666
this.rawCharacterCollision = new RawCharacterCollision();
5767
this._applyImpulsesToDynamicBodies = false;
@@ -305,9 +315,10 @@ export class KinematicCharacterController {
305315
let rawTranslationDelta = VectorOps.intoRaw(desiredTranslationDelta);
306316
this.raw.computeColliderMovement(
307317
this.params.dt,
318+
this.broadPhase.raw,
319+
this.narrowPhase.raw,
308320
this.bodies.raw,
309321
this.colliders.raw,
310-
this.queries.raw,
311322
collider.handle,
312323
rawTranslationDelta,
313324
this._applyImpulsesToDynamicBodies,

src.ts/control/pid_controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {RawPidController} from "../raw";
22
import {Rotation, RotationOps, Vector, VectorOps} from "../math";
33
import {Collider, ColliderSet, InteractionGroups, Shape} from "../geometry";
4-
import {QueryFilterFlags, QueryPipeline, World} from "../pipeline";
4+
import {QueryFilterFlags, World} from "../pipeline";
55
import {IntegrationParameters, RigidBody, RigidBodySet} from "../dynamics";
66

77
// TODO: unify with the JointAxesMask

src.ts/control/ray_cast_vehicle_controller.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,38 @@
11
import {RawDynamicRayCastVehicleController} from "../raw";
22
import {Vector, VectorOps} from "../math";
3-
import {Collider, ColliderSet, InteractionGroups} from "../geometry";
4-
import {QueryFilterFlags, QueryPipeline} from "../pipeline";
3+
import {
4+
BroadPhase,
5+
Collider,
6+
ColliderSet,
7+
InteractionGroups,
8+
NarrowPhase,
9+
} from "../geometry";
10+
import {QueryFilterFlags} from "../pipeline";
511
import {RigidBody, RigidBodyHandle, RigidBodySet} from "../dynamics";
612

713
/**
814
* A character controller to simulate vehicles using ray-casting for the wheels.
915
*/
1016
export class DynamicRayCastVehicleController {
1117
private raw: RawDynamicRayCastVehicleController;
18+
private broadPhase: BroadPhase;
19+
private narrowPhase: NarrowPhase;
1220
private bodies: RigidBodySet;
1321
private colliders: ColliderSet;
14-
private queries: QueryPipeline;
1522
private _chassis: RigidBody;
1623

1724
constructor(
1825
chassis: RigidBody,
26+
broadPhase: BroadPhase,
27+
narrowPhase: NarrowPhase,
1928
bodies: RigidBodySet,
2029
colliders: ColliderSet,
21-
queries: QueryPipeline,
2230
) {
2331
this.raw = new RawDynamicRayCastVehicleController(chassis.handle);
32+
this.broadPhase = broadPhase;
33+
this.narrowPhase = narrowPhase;
2434
this.bodies = bodies;
2535
this.colliders = colliders;
26-
this.queries = queries;
2736
this._chassis = chassis;
2837
}
2938

@@ -54,9 +63,10 @@ export class DynamicRayCastVehicleController {
5463
) {
5564
this.raw.update_vehicle(
5665
dt,
66+
this.broadPhase.raw,
67+
this.narrowPhase.raw,
5768
this.bodies.raw,
5869
this.colliders.raw,
59-
this.queries.raw,
6070
filterFlags,
6171
filterGroups,
6272
this.colliders.castClosure(filterPredicate),

0 commit comments

Comments
 (0)