Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
### Unreleased
### 0.18.0-beta.0 (12 July 2025)

#### Modified

- Update to Rapier 0.22.0-beta.1 which includes a fully reworked narrow-phase tha supports scene queries.
This implies a performance gain on large scenes by avoiding the need to re-build the underlying acceleration
structure at each frame.
- Un-deprecate methods for reading shape properties (for example `collider.radius()`). It turned out that these
methods are more convenient as they are guaranteed to always be in sync with rapier’s state on wasm.
- Add `collider.translationWrtParent()` and `collider.rotationWrtParent()` to get the collider’s transaltion/rotation
relative to its parent rigid-body.

#### Fix

- 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.
- 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.

### 0.17.3 (30 May 2025)

Expand Down
65 changes: 51 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions builds/prepare_builds/templates/Cargo.toml.tera
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dimforge_{{ js_package_name }}" # Can't be named rapier{{ dimension }}d which conflicts with the dependency.
version = "0.17.3"
version = "0.18.0-beta.0"
authors = ["Sébastien Crozet <developer@crozet.re>"]
description = "{{ dimension }}-dimensional physics engine in Rust - official JS bindings."
documentation = "https://rapier.rs/rustdoc/rapier{{ dimension }}d/index.html"
Expand All @@ -27,7 +27,7 @@ rust.unexpected_cfgs = { level = "warn", check-cfg = [
] }

[dependencies]
rapier{{ dimension }}d = { version = "0.26.1", features = [
rapier{{ dimension }}d = { version = "0.27.0-beta.0", features = [
"serde-serialize",
"debug-render",
{%- for feature in additional_features %}
Expand Down
23 changes: 17 additions & 6 deletions src.ts/control/character_controller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import {RawKinematicCharacterController, RawCharacterCollision} from "../raw";
import {Rotation, Vector, VectorOps} from "../math";
import {Collider, ColliderSet, InteractionGroups, Shape} from "../geometry";
import {QueryFilterFlags, QueryPipeline, World} from "../pipeline";
import {
BroadPhase,
Collider,
ColliderSet,
InteractionGroups,
NarrowPhase,
Shape,
} from "../geometry";
import {QueryFilterFlags, World} from "../pipeline";
import {IntegrationParameters, RigidBody, RigidBodySet} from "../dynamics";

/**
Expand Down Expand Up @@ -35,23 +42,26 @@ export class KinematicCharacterController {
private rawCharacterCollision: RawCharacterCollision;

private params: IntegrationParameters;
private broadPhase: BroadPhase;
private narrowPhase: NarrowPhase;
private bodies: RigidBodySet;
private colliders: ColliderSet;
private queries: QueryPipeline;
private _applyImpulsesToDynamicBodies: boolean;
private _characterMass: number | null;

constructor(
offset: number,
params: IntegrationParameters,
broadPhase: BroadPhase,
narrowPhase: NarrowPhase,
bodies: RigidBodySet,
colliders: ColliderSet,
queries: QueryPipeline,
) {
this.params = params;
this.bodies = bodies;
this.colliders = colliders;
this.queries = queries;
this.broadPhase = broadPhase;
this.narrowPhase = narrowPhase;
this.raw = new RawKinematicCharacterController(offset);
this.rawCharacterCollision = new RawCharacterCollision();
this._applyImpulsesToDynamicBodies = false;
Expand Down Expand Up @@ -305,9 +315,10 @@ export class KinematicCharacterController {
let rawTranslationDelta = VectorOps.intoRaw(desiredTranslationDelta);
this.raw.computeColliderMovement(
this.params.dt,
this.broadPhase.raw,
this.narrowPhase.raw,
this.bodies.raw,
this.colliders.raw,
this.queries.raw,
collider.handle,
rawTranslationDelta,
this._applyImpulsesToDynamicBodies,
Expand Down
2 changes: 1 addition & 1 deletion src.ts/control/pid_controller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {RawPidController} from "../raw";
import {Rotation, RotationOps, Vector, VectorOps} from "../math";
import {Collider, ColliderSet, InteractionGroups, Shape} from "../geometry";
import {QueryFilterFlags, QueryPipeline, World} from "../pipeline";
import {QueryFilterFlags, World} from "../pipeline";
import {IntegrationParameters, RigidBody, RigidBodySet} from "../dynamics";

// TODO: unify with the JointAxesMask
Expand Down
22 changes: 16 additions & 6 deletions src.ts/control/ray_cast_vehicle_controller.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
import {RawDynamicRayCastVehicleController} from "../raw";
import {Vector, VectorOps} from "../math";
import {Collider, ColliderSet, InteractionGroups} from "../geometry";
import {QueryFilterFlags, QueryPipeline} from "../pipeline";
import {
BroadPhase,
Collider,
ColliderSet,
InteractionGroups,
NarrowPhase,
} from "../geometry";
import {QueryFilterFlags} from "../pipeline";
import {RigidBody, RigidBodyHandle, RigidBodySet} from "../dynamics";

/**
* A character controller to simulate vehicles using ray-casting for the wheels.
*/
export class DynamicRayCastVehicleController {
private raw: RawDynamicRayCastVehicleController;
private broadPhase: BroadPhase;
private narrowPhase: NarrowPhase;
private bodies: RigidBodySet;
private colliders: ColliderSet;
private queries: QueryPipeline;
private _chassis: RigidBody;

constructor(
chassis: RigidBody,
broadPhase: BroadPhase,
narrowPhase: NarrowPhase,
bodies: RigidBodySet,
colliders: ColliderSet,
queries: QueryPipeline,
) {
this.raw = new RawDynamicRayCastVehicleController(chassis.handle);
this.broadPhase = broadPhase;
this.narrowPhase = narrowPhase;
this.bodies = bodies;
this.colliders = colliders;
this.queries = queries;
this._chassis = chassis;
}

Expand Down Expand Up @@ -54,9 +63,10 @@ export class DynamicRayCastVehicleController {
) {
this.raw.update_vehicle(
dt,
this.broadPhase.raw,
this.narrowPhase.raw,
this.bodies.raw,
this.colliders.raw,
this.queries.raw,
filterFlags,
filterGroups,
this.colliders.castClosure(filterPredicate),
Expand Down
Loading
Loading