@alexandernanberg/rapier3d 0.0.1 → 0.0.2

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.
@@ -4,13 +4,13 @@
4
4
  declare class RawBroadPhase {
5
5
  free(): void;
6
6
  [Symbol.dispose](): void;
7
- castRay(narrow_phase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, rayOrig: RawVector, rayDir: RawVector, maxToi: number, solid: boolean, filter_flags: number, filter_groups: number | null | undefined, filter_exclude_collider: number | null | undefined, filter_exclude_rigid_body: number | null | undefined, filter_predicate: Function): RawRayColliderHit | undefined;
8
- castRayAndGetNormal(narrow_phase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, rayOrig: RawVector, rayDir: RawVector, maxToi: number, solid: boolean, filter_flags: number, filter_groups: number | null | undefined, filter_exclude_collider: number | null | undefined, filter_exclude_rigid_body: number | null | undefined, filter_predicate: Function): RawRayColliderIntersection | undefined;
7
+ castRay(narrow_phase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, ray_ox: number, ray_oy: number, ray_oz: number, ray_dx: number, ray_dy: number, ray_dz: number, maxToi: number, solid: boolean, filter_flags: number, filter_groups: number | null | undefined, filter_exclude_collider: number | null | undefined, filter_exclude_rigid_body: number | null | undefined, filter_predicate: Function): RawRayColliderHit | undefined;
8
+ castRayAndGetNormal(narrow_phase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, ray_ox: number, ray_oy: number, ray_oz: number, ray_dx: number, ray_dy: number, ray_dz: number, maxToi: number, solid: boolean, filter_flags: number, filter_groups: number | null | undefined, filter_exclude_collider: number | null | undefined, filter_exclude_rigid_body: number | null | undefined, filter_predicate: Function): RawRayColliderIntersection | undefined;
9
9
  castShape(narrow_phase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, shapePos: RawVector, shapeRot: RawRotation, shapeVel: RawVector, shape: RawShape, target_distance: number, maxToi: number, stop_at_penetration: boolean, filter_flags: number, filter_groups: number | null | undefined, filter_exclude_collider: number | null | undefined, filter_exclude_rigid_body: number | null | undefined, filter_predicate: Function): RawColliderShapeCastHit | undefined;
10
10
  collidersWithAabbIntersectingAabb(narrow_phase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, aabbCenter: RawVector, aabbHalfExtents: RawVector, callback: Function): void;
11
11
  intersectionWithShape(narrow_phase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, shapePos: RawVector, shapeRot: RawRotation, shape: RawShape, filter_flags: number, filter_groups: number | null | undefined, filter_exclude_collider: number | null | undefined, filter_exclude_rigid_body: number | null | undefined, filter_predicate: Function): number | undefined;
12
12
  intersectionsWithPoint(narrow_phase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, point: RawVector, callback: Function, filter_flags: number, filter_groups: number | null | undefined, filter_exclude_collider: number | null | undefined, filter_exclude_rigid_body: number | null | undefined, filter_predicate: Function): void;
13
- intersectionsWithRay(narrow_phase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, rayOrig: RawVector, rayDir: RawVector, maxToi: number, solid: boolean, callback: Function, filter_flags: number, filter_groups: number | null | undefined, filter_exclude_collider: number | null | undefined, filter_exclude_rigid_body: number | null | undefined, filter_predicate: Function): void;
13
+ intersectionsWithRay(narrow_phase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, ray_ox: number, ray_oy: number, ray_oz: number, ray_dx: number, ray_dy: number, ray_dz: number, maxToi: number, solid: boolean, callback: Function, filter_flags: number, filter_groups: number | null | undefined, filter_exclude_collider: number | null | undefined, filter_exclude_rigid_body: number | null | undefined, filter_predicate: Function): void;
14
14
  intersectionsWithShape(narrow_phase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, shapePos: RawVector, shapeRot: RawRotation, shape: RawShape, callback: Function, filter_flags: number, filter_groups: number | null | undefined, filter_exclude_collider: number | null | undefined, filter_exclude_rigid_body: number | null | undefined, filter_predicate: Function): void;
15
15
  constructor();
16
16
  projectPoint(narrow_phase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, point: RawVector, solid: boolean, filter_flags: number, filter_groups: number | null | undefined, filter_exclude_collider: number | null | undefined, filter_exclude_rigid_body: number | null | undefined, filter_predicate: Function): RawPointColliderProjection | undefined;
@@ -959,6 +959,23 @@ declare class RawRigidBodySet {
959
959
  * - `w`: the scalar component of the quaternion.
960
960
  */
961
961
  rbSetNextKinematicRotation(handle: number, x: number, y: number, z: number, w: number): void;
962
+ /**
963
+ * If this rigid body is kinematic, sets its future translation and rotation after the next
964
+ * timestep integration in a single WASM call.
965
+ *
966
+ * # Parameters
967
+ * - `tx`, `ty`, `tz`: the world-space position of the rigid-body.
968
+ * - `rx`, `ry`, `rz`, `rw`: the rotation quaternion components.
969
+ */
970
+ rbSetNextKinematicTransform(handle: number, tx: number, ty: number, tz: number, rx: number, ry: number, rz: number, rw: number): void;
971
+ /**
972
+ * Sets next kinematic transforms for multiple rigid-bodies in a single WASM call.
973
+ *
974
+ * # Parameters
975
+ * - `data`: Float32Array with layout [handle, tx, ty, tz, rx, ry, rz, rw] × N
976
+ * - `count`: Number of bodies in the batch
977
+ */
978
+ rbSetNextKinematicTransformsBatch(data: Float32Array, count: number): void;
962
979
  /**
963
980
  * If this rigid body is kinematic, sets its future translation after the next timestep integration.
964
981
  *
@@ -989,6 +1006,24 @@ declare class RawRigidBodySet {
989
1006
  */
990
1007
  rbSetRotation(handle: number, x: number, y: number, z: number, w: number, wakeUp: boolean): void;
991
1008
  rbSetSoftCcdPrediction(handle: number, prediction: number): void;
1009
+ /**
1010
+ * Sets both the translation and rotation of this rigid-body in a single WASM call.
1011
+ *
1012
+ * # Parameters
1013
+ * - `tx`, `ty`, `tz`: the world-space position of the rigid-body.
1014
+ * - `rx`, `ry`, `rz`, `rw`: the rotation quaternion components.
1015
+ * - `wakeUp`: forces the rigid-body to wake-up so it is properly affected by forces.
1016
+ */
1017
+ rbSetTransform(handle: number, tx: number, ty: number, tz: number, rx: number, ry: number, rz: number, rw: number, wakeUp: boolean): void;
1018
+ /**
1019
+ * Sets transforms for multiple rigid-bodies in a single WASM call.
1020
+ *
1021
+ * # Parameters
1022
+ * - `data`: Float32Array with layout [handle, tx, ty, tz, rx, ry, rz, rw] × N
1023
+ * - `count`: Number of bodies in the batch
1024
+ * - `wakeUp`: forces the rigid-bodies to wake-up
1025
+ */
1026
+ rbSetTransformsBatch(data: Float32Array, count: number, wakeUp: boolean): void;
992
1027
  /**
993
1028
  * Sets the translation of this rigid-body.
994
1029
  *
@@ -2241,6 +2276,46 @@ declare class World {
2241
2276
  * @param body - The description of the rigid-body to create.
2242
2277
  */
2243
2278
  createRigidBody(body: RigidBodyDesc): RigidBody;
2279
+ /**
2280
+ * Sets transforms for multiple rigid-bodies in a single WASM call.
2281
+ *
2282
+ * This is more efficient than calling `setTransform` on each body individually
2283
+ * when you need to update many bodies at once.
2284
+ *
2285
+ * @param batch - The batch of transforms to apply.
2286
+ * @param wakeUp - Forces the rigid-bodies to wake-up so they are properly affected by forces.
2287
+ *
2288
+ * @example
2289
+ * ```typescript
2290
+ * const batch = RAPIER.createTransformBatch(1000);
2291
+ * batch.clear();
2292
+ * for (const body of dynamicBodies) {
2293
+ * batch.add(body.handle, newPosition, newRotation);
2294
+ * }
2295
+ * world.setTransformsBatch(batch, true);
2296
+ * ```
2297
+ */
2298
+ setTransformsBatch(batch: TransformBatch, wakeUp: boolean): void;
2299
+ /**
2300
+ * Sets next kinematic transforms for multiple rigid-bodies in a single WASM call.
2301
+ *
2302
+ * This is more efficient than calling `setNextKinematicTransform` on each body individually
2303
+ * when you need to update many kinematic bodies at once.
2304
+ *
2305
+ * @param batch - The batch of transforms to apply.
2306
+ *
2307
+ * @example
2308
+ * ```typescript
2309
+ * const batch = RAPIER.createTransformBatch(1000);
2310
+ * batch.clear();
2311
+ * for (const body of kinematicBodies) {
2312
+ * batch.add(body.handle, mesh.position, mesh.quaternion);
2313
+ * }
2314
+ * world.setNextKinematicTransformsBatch(batch);
2315
+ * world.step();
2316
+ * ```
2317
+ */
2318
+ setNextKinematicTransformsBatch(batch: TransformBatch): void;
2244
2319
  /**
2245
2320
  * Creates a new character controller.
2246
2321
  *
@@ -4911,6 +4986,29 @@ declare class RigidBody {
4911
4986
  * @param rot - The kinematic rotation to set.
4912
4987
  */
4913
4988
  setNextKinematicRotation(rot: Rotation): void;
4989
+ /**
4990
+ * Sets both the translation and rotation of this rigid-body in a single WASM call.
4991
+ *
4992
+ * This is more efficient than calling `setTranslation` and `setRotation` separately
4993
+ * when both need to be updated.
4994
+ *
4995
+ * @param tra - The world-space position of the rigid-body.
4996
+ * @param rot - The rotation to set.
4997
+ * @param wakeUp - Forces the rigid-body to wake-up so it is properly affected by forces if it
4998
+ * wasn't moving before modifying its position.
4999
+ */
5000
+ setTransform(tra: Vector, rot: Rotation, wakeUp: boolean): void;
5001
+ /**
5002
+ * If this rigid body is kinematic, sets its future translation and rotation after the next
5003
+ * timestep integration in a single WASM call.
5004
+ *
5005
+ * This is more efficient than calling `setNextKinematicTranslation` and `setNextKinematicRotation`
5006
+ * separately when both need to be updated.
5007
+ *
5008
+ * @param tra - The kinematic translation to set.
5009
+ * @param rot - The kinematic rotation to set.
5010
+ */
5011
+ setNextKinematicTransform(tra: Vector, rot: Rotation): void;
4914
5012
  /**
4915
5013
  * The linear velocity of this rigid-body.
4916
5014
  *
@@ -6055,8 +6153,87 @@ declare class CCDSolver {
6055
6153
  free(): void;
6056
6154
  constructor(raw?: RawCCDSolver);
6057
6155
  }
6156
+ //#endregion
6157
+ //#region src/dynamics/transform_batch.d.ts
6158
+ /**
6159
+ * A batch of transforms for efficient bulk updates.
6160
+ *
6161
+ * This class allows you to collect multiple body transforms and apply them
6162
+ * all in a single WASM call, reducing boundary-crossing overhead.
6163
+ *
6164
+ * @example
6165
+ * ```typescript
6166
+ * const batch = RAPIER.createTransformBatch(1000);
6167
+ *
6168
+ * // In your game loop:
6169
+ * batch.clear();
6170
+ * for (const body of kinematicBodies) {
6171
+ * batch.add(body.handle, mesh.position, mesh.quaternion);
6172
+ * }
6173
+ * world.setNextKinematicTransformsBatch(batch);
6174
+ * world.step();
6175
+ * ```
6176
+ */
6177
+ declare class TransformBatch {
6178
+ /** @internal */
6179
+ buffer: Float32Array;
6180
+ /** @internal */
6181
+ count: number;
6182
+ private static FLOATS_PER_ENTRY;
6183
+ /**
6184
+ * Creates a new TransformBatch with the given initial capacity.
6185
+ *
6186
+ * @param capacity - The initial number of transforms this batch can hold.
6187
+ */
6188
+ constructor(capacity: number);
6189
+ /**
6190
+ * The current number of transforms in the batch.
6191
+ */
6192
+ get length(): number;
6193
+ /**
6194
+ * The maximum number of transforms this batch can hold without growing.
6195
+ */
6196
+ get capacity(): number;
6197
+ /**
6198
+ * Clears all transforms from the batch.
6199
+ * Call this at the start of each frame before adding new transforms.
6200
+ */
6201
+ clear(): void;
6202
+ /**
6203
+ * Adds a transform to the batch.
6204
+ *
6205
+ * @param handle - The rigid body handle.
6206
+ * @param translation - The position to set.
6207
+ * @param rotation - The rotation quaternion to set.
6208
+ */
6209
+ add(handle: RigidBodyHandle, translation: Vector, rotation: Rotation): void;
6210
+ private grow;
6211
+ }
6212
+ /**
6213
+ * Creates a new TransformBatch for efficient bulk body updates.
6214
+ *
6215
+ * @param capacity - The initial number of transforms the batch can hold.
6216
+ * The batch will automatically grow if more are added.
6217
+ * @returns A new TransformBatch instance.
6218
+ *
6219
+ * @example
6220
+ * ```typescript
6221
+ * // Create once, reuse every frame
6222
+ * const batch = RAPIER.createTransformBatch(1000);
6223
+ *
6224
+ * function update() {
6225
+ * batch.clear();
6226
+ * for (const body of kinematicBodies) {
6227
+ * batch.add(body.handle, mesh.position, mesh.quaternion);
6228
+ * }
6229
+ * world.setNextKinematicTransformsBatch(batch);
6230
+ * world.step();
6231
+ * }
6232
+ * ```
6233
+ */
6234
+ declare function createTransformBatch(capacity: number): TransformBatch;
6058
6235
  declare namespace exports_d_exports {
6059
- export { ActiveCollisionTypes, ActiveEvents, ActiveHooks, Ball, BroadPhase, CCDSolver, Capsule, CharacterCollision, CoefficientCombineRule, Collider, ColliderDesc, ColliderHandle, ColliderSet, ColliderShapeCastHit, Cone, ConvexPolyhedron, Cuboid, Cylinder, DebugRenderBuffers, DebugRenderPipeline, DynamicRayCastVehicleController, EventQueue, FeatureType, FixedImpulseJoint, FixedMultibodyJoint, GenericImpulseJoint, HalfSpace, HeightFieldFlags, Heightfield, ImpulseJoint, ImpulseJointHandle, ImpulseJointSet, IntegrationParameters, InteractionGroups, IslandManager, JointAxesMask, JointData, JointType, KinematicCharacterController, MassPropsMode, MotorModel, MultibodyJoint, MultibodyJointHandle, MultibodyJointSet, NarrowPhase, PhysicsHooks, PhysicsPipeline, PidAxesMask, PidController, PointColliderProjection, PointProjection, Polyline, PrismaticImpulseJoint, PrismaticMultibodyJoint, Quaternion, QueryFilterFlags, Ray, RayColliderHit, RayColliderIntersection, RayIntersection, RevoluteImpulseJoint, RevoluteMultibodyJoint, RigidBody, RigidBodyDesc, RigidBodyHandle, RigidBodySet, RigidBodyType, RopeImpulseJoint, Rotation, RotationOps, RoundCone, RoundConvexPolyhedron, RoundCuboid, RoundCylinder, RoundTriangle, SdpMatrix3, SdpMatrix3Ops, Segment, SerializationPipeline, Shape, ShapeCastHit, ShapeContact, ShapeType, SolverFlags, SphericalImpulseJoint, SphericalMultibodyJoint, SpringImpulseJoint, TempContactForceEvent, TempContactManifold, TriMesh, TriMeshFlags, Triangle, UnitImpulseJoint, UnitMultibodyJoint, Vector, Vector3, VectorOps, Voxels, World, reserveMemory, version };
6236
+ export { ActiveCollisionTypes, ActiveEvents, ActiveHooks, Ball, BroadPhase, CCDSolver, Capsule, CharacterCollision, CoefficientCombineRule, Collider, ColliderDesc, ColliderHandle, ColliderSet, ColliderShapeCastHit, Cone, ConvexPolyhedron, Cuboid, Cylinder, DebugRenderBuffers, DebugRenderPipeline, DynamicRayCastVehicleController, EventQueue, FeatureType, FixedImpulseJoint, FixedMultibodyJoint, GenericImpulseJoint, HalfSpace, HeightFieldFlags, Heightfield, ImpulseJoint, ImpulseJointHandle, ImpulseJointSet, IntegrationParameters, InteractionGroups, IslandManager, JointAxesMask, JointData, JointType, KinematicCharacterController, MassPropsMode, MotorModel, MultibodyJoint, MultibodyJointHandle, MultibodyJointSet, NarrowPhase, PhysicsHooks, PhysicsPipeline, PidAxesMask, PidController, PointColliderProjection, PointProjection, Polyline, PrismaticImpulseJoint, PrismaticMultibodyJoint, Quaternion, QueryFilterFlags, Ray, RayColliderHit, RayColliderIntersection, RayIntersection, RevoluteImpulseJoint, RevoluteMultibodyJoint, RigidBody, RigidBodyDesc, RigidBodyHandle, RigidBodySet, RigidBodyType, RopeImpulseJoint, Rotation, RotationOps, RoundCone, RoundConvexPolyhedron, RoundCuboid, RoundCylinder, RoundTriangle, SdpMatrix3, SdpMatrix3Ops, Segment, SerializationPipeline, Shape, ShapeCastHit, ShapeContact, ShapeType, SolverFlags, SphericalImpulseJoint, SphericalMultibodyJoint, SpringImpulseJoint, TempContactForceEvent, TempContactManifold, TransformBatch, TriMesh, TriMeshFlags, Triangle, UnitImpulseJoint, UnitMultibodyJoint, Vector, Vector3, VectorOps, Voxels, World, createTransformBatch, reserveMemory, version };
6060
6237
  }
6061
6238
  declare function version(): string;
6062
6239
  declare function reserveMemory(extraBytesCount: number): void;
@@ -6068,5 +6245,5 @@ declare function reserveMemory(extraBytesCount: number): void;
6068
6245
  */
6069
6246
  declare function init(): Promise<void>;
6070
6247
  //#endregion
6071
- export { ActiveCollisionTypes, ActiveEvents, ActiveHooks, Ball, BroadPhase, CCDSolver, Capsule, CharacterCollision, CoefficientCombineRule, Collider, ColliderDesc, ColliderHandle, ColliderSet, ColliderShapeCastHit, Cone, ConvexPolyhedron, Cuboid, Cylinder, DebugRenderBuffers, DebugRenderPipeline, DynamicRayCastVehicleController, EventQueue, FeatureType, FixedImpulseJoint, FixedMultibodyJoint, GenericImpulseJoint, HalfSpace, HeightFieldFlags, Heightfield, ImpulseJoint, ImpulseJointHandle, ImpulseJointSet, IntegrationParameters, InteractionGroups, IslandManager, JointAxesMask, JointData, JointType, KinematicCharacterController, MassPropsMode, MotorModel, MultibodyJoint, MultibodyJointHandle, MultibodyJointSet, NarrowPhase, PhysicsHooks, PhysicsPipeline, PidAxesMask, PidController, PointColliderProjection, PointProjection, Polyline, PrismaticImpulseJoint, PrismaticMultibodyJoint, Quaternion, QueryFilterFlags, Ray, RayColliderHit, RayColliderIntersection, RayIntersection, RevoluteImpulseJoint, RevoluteMultibodyJoint, RigidBody, RigidBodyDesc, RigidBodyHandle, RigidBodySet, RigidBodyType, RopeImpulseJoint, Rotation, RotationOps, RoundCone, RoundConvexPolyhedron, RoundCuboid, RoundCylinder, RoundTriangle, SdpMatrix3, SdpMatrix3Ops, Segment, SerializationPipeline, Shape, ShapeCastHit, ShapeContact, ShapeType, SolverFlags, SphericalImpulseJoint, SphericalMultibodyJoint, SpringImpulseJoint, TempContactForceEvent, TempContactManifold, TriMesh, TriMeshFlags, Triangle, UnitImpulseJoint, UnitMultibodyJoint, Vector, Vector3, VectorOps, Voxels, World, exports_d_exports as default, init, reserveMemory, version };
6248
+ export { ActiveCollisionTypes, ActiveEvents, ActiveHooks, Ball, BroadPhase, CCDSolver, Capsule, CharacterCollision, CoefficientCombineRule, Collider, ColliderDesc, ColliderHandle, ColliderSet, ColliderShapeCastHit, Cone, ConvexPolyhedron, Cuboid, Cylinder, DebugRenderBuffers, DebugRenderPipeline, DynamicRayCastVehicleController, EventQueue, FeatureType, FixedImpulseJoint, FixedMultibodyJoint, GenericImpulseJoint, HalfSpace, HeightFieldFlags, Heightfield, ImpulseJoint, ImpulseJointHandle, ImpulseJointSet, IntegrationParameters, InteractionGroups, IslandManager, JointAxesMask, JointData, JointType, KinematicCharacterController, MassPropsMode, MotorModel, MultibodyJoint, MultibodyJointHandle, MultibodyJointSet, NarrowPhase, PhysicsHooks, PhysicsPipeline, PidAxesMask, PidController, PointColliderProjection, PointProjection, Polyline, PrismaticImpulseJoint, PrismaticMultibodyJoint, Quaternion, QueryFilterFlags, Ray, RayColliderHit, RayColliderIntersection, RayIntersection, RevoluteImpulseJoint, RevoluteMultibodyJoint, RigidBody, RigidBodyDesc, RigidBodyHandle, RigidBodySet, RigidBodyType, RopeImpulseJoint, Rotation, RotationOps, RoundCone, RoundConvexPolyhedron, RoundCuboid, RoundCylinder, RoundTriangle, SdpMatrix3, SdpMatrix3Ops, Segment, SerializationPipeline, Shape, ShapeCastHit, ShapeContact, ShapeType, SolverFlags, SphericalImpulseJoint, SphericalMultibodyJoint, SpringImpulseJoint, TempContactForceEvent, TempContactManifold, TransformBatch, TriMesh, TriMeshFlags, Triangle, UnitImpulseJoint, UnitMultibodyJoint, Vector, Vector3, VectorOps, Voxels, World, createTransformBatch, exports_d_exports as default, init, reserveMemory, version };
6072
6249
  //# sourceMappingURL=compat-simd.d.mts.map