### setUp Source: https://rapier.rs/javascript2d/classes/KinematicCharacterController.html Sets the direction that defines 'up', used for determining the floor and its angle. ```APIDOC ## setUp ### Description Sets the direction that goes "up". Used to determine where the floor is, and the floor’s angle. ### Method SET ### Endpoint /setUp ### Parameters #### Request Body - **vector** (Vector) - Required - The 'up' direction vector. ### Response #### Success Response (200) - **void** - No return value. ``` -------------------------------- ### frictionCombineRule Source: https://rapier.rs/javascript2d/classes/Collider.html Gets the rule used to combine friction coefficients. ```APIDOC ## frictionCombineRule ### Description Gets the rule used to combine the friction coefficients of two colliders involved in a contact. ### Method GET ### Endpoint `/collider/{colliderId}/frictionCombineRule` ### Returns - **CoefficientCombineRule**: The friction combine rule. ``` -------------------------------- ### get Source: https://rapier.rs/javascript2d/classes/RigidBodySet.html Retrieves a rigid body from the set using its handle. ```APIDOC ## get ### Description Gets the rigid-body with the given handle. ### Method `get(handle: number): RigidBody` ### Parameters * `handle` (number) - Required - The handle of the rigid-body to retrieve. ### Returns `RigidBody` - The rigid body associated with the handle. ``` -------------------------------- ### timingVelocityAssembly Source: https://rapier.rs/javascript2d/classes/World.html Gets the time spent in milliseconds by the last step to run the constraint initialization. This timing is included in `timingSolver`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`. ```APIDOC ## timingVelocityAssembly ### Description The time spent in milliseconds by the last step to run the constraint initialization. This timing is included in `timingSolver`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`. ### Method `timingVelocityAssembly()` ### Returns number - The time in milliseconds. ``` -------------------------------- ### timingVelocityWriteback Source: https://rapier.rs/javascript2d/classes/World.html Gets the time spent in milliseconds by writing rigid-body velocities calculated by the solver back into the rigid-bodies. This timing is included in `timingSolver`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`. ```APIDOC ## timingVelocityWriteback ### Description The time spent in milliseconds by writing rigid-body velocities calculated by the solver back into the rigid-bodies. This timing is included in `timingSolver`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`. ### Method `timingVelocityWriteback()` ### Returns number - The time in milliseconds. ``` -------------------------------- ### World.numInternalPgsIterations Source: https://rapier.rs/javascript2d/classes/World.html Gets or sets the number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration. Increasing this parameter will improve stability of the simulation. ```APIDOC ## World.numInternalPgsIterations ### Description Gets or sets the number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration. Increasing this parameter will improve stability of the simulation. ### Getter * **numInternalPgsIterations**(): number * Returns the current number of internal PGS iterations. ### Setter * **numInternalPgsIterations**(niter: number): void * Sets the number of internal PGS iterations. * **Parameters**: * niter (number) - The new number of internal PGS iterations. ``` -------------------------------- ### restitution Source: https://rapier.rs/javascript2d/classes/Collider.html Gets the restitution coefficient of this collider. ```APIDOC ## restitution ### Description The restitution coefficient of this collider. ### Method restitution() ### Returns * **number** - The restitution coefficient. ``` -------------------------------- ### rotation Source: https://rapier.rs/javascript2d/classes/RigidBody.html Gets the current world-space orientation of the rigid-body. ```APIDOC ## rotation ### Description Gets the world-space orientation of this rigid-body. ### Method N/A (getter-like method) ### Endpoint N/A ### Returns - **number**: The world-space orientation. ``` -------------------------------- ### createRigidBody Source: https://rapier.rs/javascript2d/classes/RigidBodySet.html Creates a new rigid body and returns its integer handle. Requires a ColliderSet and a RigidBodyDesc. ```APIDOC ## createRigidBody ### Description Creates a new rigid-body and return its integer handle. ### Method `createRigidBody(colliderSet: ColliderSet, desc: RigidBodyDesc): RigidBody` ### Parameters * `colliderSet` (ColliderSet) - Required - The collider set to associate with the new rigid body. * `desc` (RigidBodyDesc) - Required - The description of the rigid-body to create. ### Returns `RigidBody` - The newly created rigid body. ``` -------------------------------- ### angularDamping Source: https://rapier.rs/javascript2d/classes/RigidBody.html Gets the angular damping coefficient of the rigid-body. ```APIDOC ## angularDamping ### Description The angular damping coefficient of this rigid-body. ### Method `angularDamping(): number` ### Returns number ``` -------------------------------- ### constructor Source: https://rapier.rs/javascript2d/classes/NarrowPhase.html Creates a new NarrowPhase instance. It's important to free this resource manually using `narrowPhase.free()` when done to avoid memory leaks. ```APIDOC ## constructor NarrowPhase ### Description Initializes a new NarrowPhase object. This object manages the precise collision detection logic. ### Method `new NarrowPhase(raw?: RawNarrowPhase): NarrowPhase` ### Parameters #### Path Parameters * `raw` (RawNarrowPhase) - Optional - The raw WASM representation of the narrow-phase. If not provided, a new one will be created. ### Returns NarrowPhase - A new instance of the NarrowPhase class. ``` -------------------------------- ### effectiveInvMass Source: https://rapier.rs/javascript2d/classes/RigidBody.html Gets the inverse mass, adjusted for translation locking. ```APIDOC ## effectiveInvMass ### Description The inverse mass taking into account translation locking. ### Method `effectiveInvMass(): Vector` ### Returns Vector ``` -------------------------------- ### DebugRenderPipeline Constructor Source: https://rapier.rs/javascript2d/classes/DebugRenderPipeline.html Initializes a new instance of the DebugRenderPipeline class. It's important to free the WASM resources manually when done. ```APIDOC ## new DebugRenderPipeline(raw?) ### Description Initializes a new instance of the DebugRenderPipeline class. ### Parameters * `raw` (RawDebugRenderPipeline) - Optional. The raw pipeline to use. ### Returns DebugRenderPipeline ``` -------------------------------- ### PhysicsPipeline Constructor Source: https://rapier.rs/javascript2d/classes/PhysicsPipeline.html Initializes a new instance of the PhysicsPipeline class. Optionally takes a raw physics pipeline object. ```APIDOC ## new PhysicsPipeline(raw?) ### Description Initializes a new instance of the PhysicsPipeline class. Optionally takes a raw physics pipeline object. ### Parameters * `raw` (RawPhysicsPipeline) - Optional - The raw physics pipeline object to initialize with. ### Returns PhysicsPipeline ``` -------------------------------- ### SerializationPipeline Constructor Source: https://rapier.rs/javascript2d/classes/SerializationPipeline.html Initializes a new instance of the SerializationPipeline. It can optionally take a RawSerializationPipeline as an argument. ```APIDOC ## new SerializationPipeline(raw?) ### Description Initializes a new instance of the SerializationPipeline. It can optionally take a RawSerializationPipeline as an argument. ### Parameters * `raw` (RawSerializationPipeline) - Optional - The raw serialization pipeline to initialize with. ### Returns SerializationPipeline ``` -------------------------------- ### Static fromRaw Source: https://rapier.rs/javascript2d/classes/HalfSpace.html Creates a HalfSpace from its raw representation. ```APIDOC ## `Static` fromRaw ### Description Creates a half-space from its raw representation in instant mode without a cache. ### Parameters * **rawSet** (RawColliderSet) - The set of raw colliders. * **handle** (number) - The handle of the raw collider to use. ### Returns Shape - The created half-space shape. ``` -------------------------------- ### linvel Source: https://rapier.rs/javascript2d/classes/RigidBody.html Gets the current linear velocity of the rigid-body in world space. ```APIDOC ## linvel ### Description Gets the linear velocity of this rigid-body. ### Method N/A (getter-like method) ### Endpoint N/A ### Returns - **Vector**: The linear velocity of the rigid-body in world space. ``` -------------------------------- ### gravityScale Source: https://rapier.rs/javascript2d/classes/RigidBody.html Gets the scale factor applied to the gravity affecting this rigid-body. ```APIDOC ## gravityScale ### Description The scale factor applied to the gravity affecting this rigid-body. ### Method `gravityScale(): number` ### Returns number ``` -------------------------------- ### BroadPhase Constructor Source: https://rapier.rs/javascript2d/classes/BroadPhase.html Initializes a new BroadPhase instance. It's recommended to free the WASM resources manually using `broadPhase.free()` when done. ```APIDOC ## new BroadPhase(raw?) ### Description Initializes a new BroadPhase instance. ### Parameters * `raw` (RawBroadPhase) - Optional - The raw broad-phase data. ### Returns * BroadPhase - A new BroadPhase instance. ``` -------------------------------- ### RevoluteImpulseJoint Constructors Source: https://rapier.rs/javascript2d/classes/RevoluteImpulseJoint.html Provides information on how to construct a RevoluteImpulseJoint. ```APIDOC ## constructor ### Description Initializes a new instance of the RevoluteImpulseJoint class. ### Parameters * `rawSet`: RawImpulseJointSet - The raw set of impulse joints. * `bodySet`: RigidBodySet - The set of rigid bodies. * `handle`: number - The handle for this joint. ``` -------------------------------- ### dominanceGroup Source: https://rapier.rs/javascript2d/classes/RigidBody.html Gets the dominance group of the rigid-body, which ranges from -127 to +127. ```APIDOC ## dominanceGroup ### Description The dominance group, in [-127, +127] this rigid-body is part of. ### Method `dominanceGroup(): number` ### Returns number ``` -------------------------------- ### VectorOps Constructor Source: https://rapier.rs/javascript2d/classes/VectorOps.html Initializes a new instance of the VectorOps class. ```APIDOC ## Constructor VectorOps ### Description Initializes a new instance of the VectorOps class. ### Returns - VectorOps: A new instance of VectorOps. ``` -------------------------------- ### intersectionWithShape Source: https://rapier.rs/javascript2d/classes/BroadPhase.html Gets the handle of up to one collider intersecting the given shape. ```APIDOC ## intersectionWithShape ### Description Gets the handle of up to one collider intersecting the given shape. ### Method (Implicitly a method call, not HTTP) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **narrowPhase**: NarrowPhase * **bodies**: RigidBodySet * **colliders**: ColliderSet - The set of colliders taking part in this pipeline. * **shapePos**: Vector - The position of the shape used for the intersection test. * **shapeRot**: number - The orientation of the shape used for the intersection test. * **shape**: Shape - The shape used for the intersection test. * **filterFlags** (QueryFilterFlags) - Optional * **filterGroups** (number) - Optional * **filterExcludeCollider** (number) - Optional * **filterExcludeRigidBody** (number) - Optional * **filterPredicate**: ((collider) => boolean) - Optional ### Returns * **number** * **boolean** ``` -------------------------------- ### PhysicsPipeline.step Source: https://rapier.rs/javascript2d/classes/PhysicsPipeline.html Executes a single step of the physics simulation. ```APIDOC ## step(gravity, integrationParameters, islands, broadPhase, narrowPhase, bodies, colliders, impulseJoints, multibodyJoints, ccdSolver, eventQueue?, hooks?) ### Description Executes a single step of the physics simulation, advancing the state of the physics world. ### Parameters * `gravity` (Vector) - The gravity vector to apply during the simulation step. * `integrationParameters` (IntegrationParameters) - The parameters for numerical integration. * `islands` (IslandManager) - The manager for physics islands. * `broadPhase` (BroadPhase) - The broad-phase collision detection algorithm. * `narrowPhase` (NarrowPhase) - The narrow-phase collision detection algorithm. * `bodies` (RigidBodySet) - The set of rigid bodies in the simulation. * `colliders` (ColliderSet) - The set of colliders in the simulation. * `impulseJoints` (ImpulseJointSet) - The set of impulse joints. * `multibodyJoints` (MultibodyJointSet) - The set of multibody joints. * `ccdSolver` (CCDSolver) - The CCD solver for continuous collision detection. * `eventQueue` (EventQueue) - Optional - The event queue for handling simulation events. * `hooks` (PhysicsHooks) - Optional - Custom hooks to be executed during the simulation. ### Returns void ``` -------------------------------- ### get Source: https://rapier.rs/javascript2d/classes/MultibodyJointSet.html Retrieves a joint by its handle. Returns null if the joint does not exist. ```APIDOC ## get(handle) ### Description Gets the joint with the specified handle. Returns `null` if no joint with the specified handle exists. ### Parameters * `handle` (number): The integer handle of the joint to retrieve. ### Returns MultibodyJoint | null: The requested joint, or `null` if it is not found. ``` -------------------------------- ### softCcdPrediction Source: https://rapier.rs/javascript2d/classes/RigidBody.html Gets the soft-CCD (Continuous Collision Detection) prediction distance for this rigid-body. ```APIDOC ## softCcdPrediction ### Description Gets the soft-CCD prediction distance for this rigid-body. See the documentation of `RigidBodyDesc.setSoftCcdPrediction` for additional details. ### Method number ### Returns number ``` -------------------------------- ### World Constructor Source: https://rapier.rs/javascript2d/classes/World.html Initializes a new instance of the World class. This constructor allows for extensive customization of the physics simulation by providing optional parameters for various physics components. ```APIDOC ## new World(gravity, rawIntegrationParameters?, rawIslands?, rawBroadPhase?, rawNarrowPhase?, rawBodies?, rawColliders?, rawImpulseJoints?, rawMultibodyJoints?, rawCCDSolver?, rawPhysicsPipeline?, rawSerializationPipeline?, rawDebugRenderPipeline?): World ### Description Initializes a new instance of the World class with specified physics simulation parameters. ### Parameters #### Path Parameters * **gravity** (Vector) - Required - The gravitational force applied to the world. * **rawIntegrationParameters** (RawIntegrationParameters) - Optional - Parameters for the integration step. * **rawIslands** (RawIslandManager) - Optional - Manages the islands of colliders. * **rawBroadPhase** (RawBroadPhase) - Optional - The broad-phase collision detection algorithm. * **rawNarrowPhase** (RawNarrowPhase) - Optional - The narrow-phase collision detection algorithm. * **rawBodies** (RawRigidBodySet) - Optional - The set of rigid bodies in the world. * **rawColliders** (RawColliderSet) - Optional - The set of colliders in the world. * **rawImpulseJoints** (RawImpulseJointSet) - Optional - The set of impulse joints. * **rawMultibodyJoints** (RawMultibodyJointSet) - Optional - The set of multibody joints. * **rawCCDSolver** (RawCCDSolver) - Optional - The CCD solver. * **rawPhysicsPipeline** (RawPhysicsPipeline) - Optional - The physics simulation pipeline. * **rawSerializationPipeline** (RawSerializationPipeline) - Optional - The serialization pipeline. * **rawDebugRenderPipeline** (RawDebugRenderPipeline) - Optional - The debug rendering pipeline. ### Returns * **World** - A new instance of the World class. ``` -------------------------------- ### version() Source: https://rapier.rs/javascript2d/functions/version.html Retrieves the current version of the @dimforge/rapier2d library. ```APIDOC ## version() ### Description Retrieves the current version of the @dimforge/rapier2d library. ### Method N/A (JavaScript function) ### Endpoint N/A (JavaScript function) ### Parameters None ### Response #### Success Response (string) - Returns the version string of the library. ### Response Example ``` "1.0.0" ``` ``` -------------------------------- ### World Class Methods Source: https://rapier.rs/javascript2d/classes/World.html This section details the various methods available on the World object for interacting with and simulating the physics environment. ```APIDOC ## World Class Methods ### Description Provides methods for interacting with and simulating the physics environment, including raycasting, collision detection, object manipulation, and simulation stepping. ### Methods - **castRay(ray: Ray, maxToi: number, solid: boolean): RayIntersection | null** Casts a ray into the world and returns the first intersection, if any. - **castRayAndGetNormal(ray: Ray, maxToi: number, solid: boolean): RayIntersection | null** Casts a ray into the world and returns the first intersection, including the normal at the intersection point. - **castShape(shape: Shape, position: Vector, rotation: Rotation, maxToi: number, solid: boolean): ShapeCaster['castShape'] | null** Casts a shape into the world and returns the first intersection, if any. - **collidersWithAabb(aabb: Aabb): Collider[]** Returns a list of all colliders that intersect with the given Aabb. - **intersectingAabb(aabb: Aabb): Collider[]** Returns a list of all colliders that intersect with the given Aabb. - **contactPair(collider1: Collider, collider2: Collider): ContactManifold | null** Retrieves the contact manifold between two specific colliders, if they are in contact. - **contactPairsWith(collider: Collider): ContactManifold[]** Retrieves all contact manifolds involving a specific collider. - **createCharacterController(desc: CharacterControllerDesc): CharacterController** Creates a new character controller with the given description. - **createCollider(desc: ColliderDesc): Collider** Creates a new collider with the given description. - **createImpulseJoint(desc: ImpulseJointDesc): ImpulseJoint** Creates a new impulse joint with the given description. - **createMultibodyJoint(desc: MultibodyJointDesc): MultibodyJoint** Creates a new multibody joint with the given description. - **createPidController(desc: PidControllerDesc): PidController** Creates a new PID controller with the given description. - **createRigidBody(desc: RigidBodyDesc): RigidBody** Creates a new rigid body with the given description. - **debugRender(): void** Renders the physics world for debugging purposes. - **forEachActiveRigidBody(callback: (body: RigidBody) => void): void** Iterates over all active rigid bodies in the world. - **forEachCollider(callback: (collider: Collider) => void): void** Iterates over all colliders in the world. - **forEachRigidBody(callback: (body: RigidBody) => void): void** Iterates over all rigid bodies in the world. - **free(): void** Frees the resources used by the world. - **getCollider(handle: ColliderHandle): Collider | null** Retrieves a collider by its handle. - **getImpulseJoint(handle: ImpulseJointHandle): ImpulseJoint | null** Retrieves an impulse joint by its handle. - **getMultibodyJoint(handle: MultibodyJointHandle): MultibodyJoint | null** Retrieves a multibody joint by its handle. - **getRigidBody(handle: RigidBodyHandle): RigidBody | null** Retrieves a rigid body by its handle. - **intersectionPair(collider1: Collider, collider2: Collider): boolean** Checks if two colliders intersect. - **intersectionPairsWith(collider: Collider): Collider[]** Returns a list of colliders that intersect with the given collider. - **intersectionWithShape(shape: Shape, position: Vector, rotation: Rotation): Collider[]** Returns a list of colliders that intersect with the given shape at the specified position and rotation. - **intersectionsWithPoint(point: Vector): Collider[]** Returns a list of colliders that contain the given point. - **intersectionsWithRay(ray: Ray): Collider[]** Returns a list of colliders that intersect with the given ray. - **intersectionsWithShape(shape: Shape, position: Vector, rotation: Rotation): Collider[]** Returns a list of colliders that intersect with the given shape at the specified position and rotation. - **projectPoint(point: Vector): Projection** Projects a point onto the closest collider in the world. - **projectPointAndGetFeature(point: Vector): Projection | null** Projects a point onto the closest collider and returns the feature (vertex, edge, face) of the collider that is closest. - **propagateModifiedBodyPositionsToColliders(): void** Updates the positions of colliders based on the positions of their associated rigid bodies. - **removeCharacterController(controller: CharacterController): void** Removes a character controller from the world. - **removeCollider(collider: Collider): void** Removes a collider from the world. - **removeImpulseJoint(joint: ImpulseJoint): void** Removes an impulse joint from the world. - **removeMultibodyJoint(joint: MultibodyJoint): void** Removes a multibody joint from the world. - **removePidController(controller: PidController): void** Removes a PID controller from the world. - **removeRigidBody(body: RigidBody): void** Removes a rigid body from the world. - **step(dt: number): void** Advances the physics simulation by a given time step. - **takeSnapshot(): any** Takes a snapshot of the current physics world state. - **restoreSnapshot(snapshot: any): void** Restores the physics world state from a snapshot. - **fromRaw(raw: any): void** Initializes the world from raw data. - **timingBroadPhase(): number** Returns the time taken by the broad-phase collision detection. - **timingCcd(): number** Returns the time taken by the Continuous Collision Detection. - **timingCcdBroadPhase(): number** Returns the time taken by the broad-phase collision detection for CCD. - **timingCcdNarrowPhase(): number** Returns the time taken by the narrow-phase collision detection for CCD. - **timingCcdSolver(): number** Returns the time taken by the CCD solver. - **timingCcdToiComputation(): number** Returns the time taken by the CCD TOI computation. - **timingCollisionDetection(): number** Returns the time taken by the collision detection phase. - **timingIslandConstruction(): number** Returns the time taken by the island construction phase. - **timingNarrowPhase(): number** Returns the time taken by the narrow-phase collision detection. - **timingSolver(): number** Returns the time taken by the solver. - **timingStep(): number** Returns the total time taken by the simulation step. - **timingUserChanges(): number** Returns the time spent on user-defined changes during the step. - **timingVelocityAssembly(): number** Returns the time taken by the velocity assembly phase. - **timingVelocityResolution(): number** Returns the time taken by the velocity resolution phase. - **timingVelocityUpdate(): number** Returns the time taken by the velocity update phase. - **timingVelocityWriteback(): number** Returns the time taken by the velocity writeback phase. ``` -------------------------------- ### nextTranslation Source: https://rapier.rs/javascript2d/classes/RigidBody.html Gets the world-space next translation of the rigid-body. Used for kinematic bodies to estimate velocity. ```APIDOC ## nextTranslation ### Description Gets the world-space next translation of this rigid-body. If this rigid-body is kinematic this value is set by the `setNextKinematicTranslation` method and is used for estimating the kinematic body velocity at the next timestep. For non-kinematic bodies, this value is currently unspecified. ### Method N/A (getter-like method) ### Endpoint N/A ### Returns - **Vector**: The world-space next translation. ``` -------------------------------- ### nextRotation Source: https://rapier.rs/javascript2d/classes/RigidBody.html Gets the world-space next orientation of the rigid-body. Used for kinematic bodies to estimate velocity. ```APIDOC ## nextRotation ### Description Gets the world-space next orientation of this rigid-body. If this rigid-body is kinematic this value is set by the `setNextKinematicRotation` method and is used for estimating the kinematic body velocity at the next timestep. For non-kinematic bodies, this value is currently unspecified. ### Method N/A (getter-like method) ### Endpoint N/A ### Returns - **number**: The world-space next orientation. ``` -------------------------------- ### enableAutostep Source: https://rapier.rs/javascript2d/classes/KinematicCharacterController.html Enables automatic stepping over small objects with specified height, width, and dynamic body inclusion. ```APIDOC ## enableAutostep ### Description Enabled automatically stepping over small objects. ### Method POST ### Endpoint /enableAutostep ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **maxHeight** (number) - Required - The maximum step height a character can automatically step over. - **minWidth** (number) - Required - The minimum width of free space that must be available after stepping on a stair. - **includeDynamicBodies** (boolean) - Required - Can the character automatically step over dynamic bodies too? ### Returns - void ``` -------------------------------- ### fromRaw Source: https://rapier.rs/javascript2d/classes/World.html Creates a new physics world from raw deserialized data. ```APIDOC ## fromRaw ### Description Creates a new physics world from raw deserialized data. ### Method `World.fromRaw(raw)` ### Parameters #### Path Parameters - **raw** (RawDeserializedWorld) - Description not provided. ``` -------------------------------- ### restitutionCombineRule Source: https://rapier.rs/javascript2d/classes/Collider.html Gets the rule used to combine the restitution coefficients of two colliders involved in a contact. ```APIDOC ## restitutionCombineRule ### Description Gets the rule used to combine the restitution coefficients of two colliders colliders involved in a contact. ### Method restitutionCombineRule() ### Returns * **CoefficientCombineRule** - The rule used for combining restitution coefficients. ``` -------------------------------- ### IntegrationParameters Constructor Source: https://rapier.rs/javascript2d/classes/IntegrationParameters.html Initializes a new instance of IntegrationParameters. It can be initialized with an optional raw object containing parameters. ```APIDOC ## new IntegrationParameters(raw?) ### Description Initializes a new instance of the IntegrationParameters class. ### Parameters * `raw` (RawIntegrationParameters) - Optional. An object containing raw integration parameters. ### Returns IntegrationParameters - A new instance of IntegrationParameters. ``` -------------------------------- ### get Source: https://rapier.rs/javascript2d/classes/ImpulseJointSet.html Retrieves an impulse joint by its handle. Returns null if no joint with the specified handle exists. ```APIDOC ## get ### Description Gets the joint with the given handle. ### Parameters * `handle` (number) - The integer handle of the joint to retrieve. ### Returns ImpulseJoint | null: The impulse joint if found, otherwise null. ``` -------------------------------- ### minSlopeSlideAngle Source: https://rapier.rs/javascript2d/classes/KinematicCharacterController.html Retrieves the minimum slope angle in radians at which the character starts to slide. Returns a number. ```APIDOC ## minSlopeSlideAngle ### Description The minimum angle (radians) between the floor’s normal and the `up` vector before the character starts to slide down automatically. ### Method GET ### Endpoint /minSlopeSlideAngle ### Returns - number: The minimum slope slide angle in radians. ``` -------------------------------- ### RevoluteImpulseJoint Methods Source: https://rapier.rs/javascript2d/classes/RevoluteImpulseJoint.html Lists and describes the methods available for interacting with RevoluteImpulseJoint objects. ```APIDOC ## anchor1 ### Description Gets the position of the first anchor of this joint. The first anchor gives the position of the application point on the local frame of the first rigid-body it is attached to. ### Returns * `Vector` ## anchor2 ### Description Gets the position of the second anchor of this joint. The second anchor gives the position of the application point on the local frame of the second rigid-body it is attached to. ### Returns * `Vector` ## body1 ### Description Gets the first rigid-body this joint is attached to. ### Returns * `RigidBody` ## body2 ### Description Gets the second rigid-body this joint is attached to. ### Returns * `RigidBody` ## configureMotor ### Description Configures the motor for this joint. ### Parameters * `targetPos`: number * `targetVel`: number * `stiffness`: number * `damping`: number ### Returns * `void` ## configureMotorModel ### Description Configures the motor model for this joint. ### Parameters * `model`: MotorModel ### Returns * `void` ## configureMotorPosition ### Description Configures the motor to control the position of the joint. ### Parameters * `targetPos`: number * `stiffness`: number * `damping`: number ### Returns * `void` ## configureMotorVelocity ### Description Configures the motor to control the velocity of the joint. ### Parameters * `targetVel`: number * `factor`: number ### Returns * `void` ## contactsEnabled ### Description Checks if contacts are enabled between colliders attached to the rigid-bodies linked by this joint. ### Returns * `boolean` ## finalizeDeserialization ### Description `Internal` method to finalize deserialization. ### Parameters * `bodySet`: RigidBodySet ### Returns * `void` ## isValid ### Description Checks if this joint is still valid (i.e. that it has not been deleted from the joint set yet). ### Returns * `boolean` ## limitsEnabled ### Description Checks if the limits are enabled for this joint. ### Returns * `boolean` ## limitsMax ### Description Gets the maximum limit of this joint. ### Returns * `number` ## limitsMin ### Description Gets the minimum limit of this joint. ### Returns * `number` ## rawAxis ### Description Gets the axis left free by this joint. ### Returns * `RawJointAxis` ## setAnchor1 ### Description Sets the position of the first anchor of this joint. The first anchor gives the position of the application point on the local frame of the first rigid-body it is attached to. ### Parameters * `newPos`: Vector - The new position for the anchor. ### Returns * `void` ## setAnchor2 ### Description Sets the position of the second anchor of this joint. The second anchor gives the position of the application point on the local frame of the second rigid-body it is attached to. ### Parameters * `newPos`: Vector - The new position for the anchor. ### Returns * `void` ## setContactsEnabled ### Description Controls whether contacts are computed between colliders attached to the rigid-bodies linked by this joint. ### Parameters * `enabled`: boolean - Whether to enable contacts. ### Returns * `void` ## setLimits ### Description Sets the limits of this joint. ### Parameters * `min`: number - The minimum bound of this joint’s free coordinate. * `max`: number - The maximum bound of this joint’s free coordinate. ### Returns * `void` ## type ### Description Gets the type of this joint. ### Returns * `JointType` ## newTyped (Static) ### Description Creates a new typed impulse joint. ### Parameters * `rawSet`: RawImpulseJointSet * `bodySet`: RigidBodySet * `handle`: number ### Returns * `ImpulseJoint` ``` -------------------------------- ### World.profilerEnabled Source: https://rapier.rs/javascript2d/classes/World.html Gets or sets whether internal performance profiling is enabled. This only works if the internal profiler is enabled. ```APIDOC ## World.profilerEnabled ### Description Gets or sets whether internal performance profiling is enabled. This only works if the internal profiler is enabled. ### Getter * **profilerEnabled**(): boolean * Returns true if the profiler is enabled, false otherwise. ### Setter * **profilerEnabled**(enabled: boolean): void * Sets whether internal performance profiling is enabled. * **Parameters**: * enabled (boolean) - True to enable the profiler, false to disable. ``` -------------------------------- ### takeSnapshot Source: https://rapier.rs/javascript2d/classes/World.html Captures the current state of the physics world as a Uint8Array. ```APIDOC ## takeSnapshot ### Description Takes a snapshot of this world. Use `World.restoreSnapshot` to create a new physics world with a state identical to the state when `.takeSnapshot()` is called. ### Method takeSnapshot ### Returns Uint8Array ``` -------------------------------- ### World.timestep Source: https://rapier.rs/javascript2d/classes/World.html Gets or sets the current simulation timestep. The simulation timestep governs by how much the physics state of the world will be integrated. ```APIDOC ## World.timestep ### Description Gets or sets the current simulation timestep. The simulation timestep governs by how much the physics state of the world will be integrated. ### Getter * **timestep**(): number * Returns the current simulation timestep. ### Setter * **timestep**(dt: number): void * Sets the new simulation timestep. * **Parameters**: * dt (number) - The timestep length, in seconds. ``` -------------------------------- ### wakeUp Source: https://rapier.rs/javascript2d/classes/RigidBody.html Wakes this rigid-body up. This is useful for dynamic bodies that have gone to sleep and need to be re-simulated. ```APIDOC ## wakeUp ### Description Wakes this rigid-body up. A dynamic rigid-body that does not move during several consecutive frames will be put to sleep by the physics engine, i.e., it will stop being simulated in order to avoid useless computations. This methods forces a sleeping rigid-body to wake-up. This is useful, e.g., before modifying the position of a dynamic body so that it is properly simulated afterwards. ### Method void ### Returns void ``` -------------------------------- ### PhysicsPipeline.free Source: https://rapier.rs/javascript2d/classes/PhysicsPipeline.html Frees the resources associated with the PhysicsPipeline instance. ```APIDOC ## free() ### Description Frees the resources associated with the PhysicsPipeline instance. ### Returns void ``` -------------------------------- ### World.maxCcdSubsteps Source: https://rapier.rs/javascript2d/classes/World.html Gets or sets the number of substeps continuous collision-detection can run. This can result in smoother paths but at a significant computational cost. ```APIDOC ## World.maxCcdSubsteps ### Description Gets or sets the number of substeps continuous collision-detection can run. This can result in smoother paths but at a significant computational cost. ### Getter * **maxCcdSubsteps**(): number * Returns the current maximum CCD substeps. ### Setter * **maxCcdSubsteps**(substeps: number): void * Sets the maximum number of CCD substeps. * **Parameters**: * substeps (number) - The number of substeps. ``` -------------------------------- ### getAll Source: https://rapier.rs/javascript2d/classes/RigidBodySet.html Retrieves all rigid bodies currently in the set. ```APIDOC ## getAll ### Description Gets all rigid-bodies in the list. ### Method `getAll(): RigidBody[]` ### Returns `RigidBody[]` - An array containing all rigid bodies in the set. ``` -------------------------------- ### World.lengthUnit Source: https://rapier.rs/javascript2d/classes/World.html Gets or sets the approximate size of most dynamic objects in the scene. This value is used internally to estimate some length-based tolerance. ```APIDOC ## World.lengthUnit ### Description Gets or sets the approximate size of most dynamic objects in the scene. This value is used internally to estimate some length-based tolerance. ### Getter * **lengthUnit**(): number * Returns the current length unit. ### Setter * **lengthUnit**(unitsPerMeter: number): void * Sets the length unit for the world. * **Parameters**: * unitsPerMeter (number) - The number of units per meter. ``` -------------------------------- ### invPrincipalInertia Source: https://rapier.rs/javascript2d/classes/RigidBody.html Gets the inverse of the principal angular inertia of the rigid-body. Zero components imply infinite inertia along that axis. ```APIDOC ## invPrincipalInertia ### Description The inverse of the principal angular inertia of the rigid-body. Components set to zero are assumed to be infinite along the corresponding principal axis. ### Method `invPrincipalInertia(): number` ### Returns number ``` -------------------------------- ### IslandManager Constructor Source: https://rapier.rs/javascript2d/classes/IslandManager.html Initializes a new instance of IslandManager. The `raw` parameter is an optional raw representation of the manager. ```APIDOC ## new IslandManager(raw?) ### Description Initializes a new instance of IslandManager. The `raw` parameter is an optional raw representation of the manager. ### Parameters * `raw` (RawIslandManager) - Optional - The raw manager to initialize with. ### Returns IslandManager ``` -------------------------------- ### ColliderShapeCastHit Constructor Source: https://rapier.rs/javascript2d/classes/ColliderShapeCastHit.html Initializes a new instance of the ColliderShapeCastHit class. ```APIDOC ## new ColliderShapeCastHit ### Description Initializes a new instance of the ColliderShapeCastHit class. ### Parameters * **collider**: Collider - The handle of the collider hit by the ray. * **time_of_impact**: number - The time of impact of the two shapes. * **witness1**: Vector - The local-space contact point on the first shape, at the time of impact. * **witness2**: Vector - The local-space contact point on the second shape, at the time of impact. * **normal1**: Vector - The local-space normal on the first shape, at the time of impact. * **normal2**: Vector - The local-space normal on the second shape, at the time of impact. ### Returns ColliderShapeCastHit ``` -------------------------------- ### setMinSlopeSlideAngle Source: https://rapier.rs/javascript2d/classes/KinematicCharacterController.html Sets the minimum angle in radians between the floor's normal and the 'up' vector at which the character will automatically start to slide down. ```APIDOC ## setMinSlopeSlideAngle ### Description Sets the minimum angle (radians) between the floor’s normal and the `up` vector before the character starts to slide down automatically. ### Method SET ### Endpoint /setMinSlopeSlideAngle ### Parameters #### Request Body - **angle** (number) - Required - The minimum slide angle in radians. ### Response #### Success Response (200) - **void** - No return value. ``` -------------------------------- ### get Source: https://rapier.rs/javascript2d/classes/ColliderSet.html Retrieves a specific collider from the set using its integer handle. This allows direct access to a collider's properties and methods. ```APIDOC ## get(handle) ### Description Retrieves the collider associated with the given handle from the set. ### Parameters * `handle` (number) - Required - The handle of the collider to retrieve. ### Returns Collider - The Collider object corresponding to the provided handle. ``` -------------------------------- ### RayColliderHit.fromRaw Static Method Source: https://rapier.rs/javascript2d/classes/RayColliderHit.html Creates a RayColliderHit instance from raw data. ```APIDOC ## `Static` fromRaw ### Description Creates a RayColliderHit instance from raw data. ### Signature `fromRaw(colliderSet: ColliderSet, raw: RawRayColliderHit): RayColliderHit` ### Parameters * **colliderSet** (ColliderSet) - The set of colliders. * **raw** (RawRayColliderHit) - The raw hit data. ``` -------------------------------- ### timingUserChanges Source: https://rapier.rs/javascript2d/classes/World.html Gets the total time spent propagating detected user changes. This method only works if the internal profiler is enabled with `World.profilerEnabled = true`. ```APIDOC ## timingUserChanges ### Description The total time spent propagating detected user changes. Only works if the internal profiler is enabled with `World.profilerEnabled = true`. ### Method `timingUserChanges()` ### Returns number - The total time in milliseconds. ``` -------------------------------- ### CCDSolver Constructor Source: https://rapier.rs/javascript2d/classes/CCDSolver.html Initializes a new instance of the CCDSolver. It can optionally take a RawCCDSolver object. ```APIDOC ## new CCDSolver(raw?) ### Description Initializes a new instance of the CCDSolver. It can optionally take a RawCCDSolver object. ### Parameters #### Path Parameters * `raw` (RawCCDSolver) - Optional - The raw CCDSolver object to initialize with. ### Returns * CCDSolver - A new instance of the CCDSolver. ``` -------------------------------- ### free Source: https://rapier.rs/javascript2d/classes/BroadPhase.html Releases the WASM memory occupied by this broad-phase. ```APIDOC ## free ### Description Release the WASM memory occupied by this broad-phase. ### Method (Implicitly a method call, not HTTP) ### Parameters None ### Returns * **void** ``` -------------------------------- ### RopeImpulseJoint Methods Source: https://rapier.rs/javascript2d/classes/RopeImpulseJoint.html Provides access to various methods for RopeImpulseJoint, including getting anchor positions, attached bodies, and checking joint validity. ```APIDOC ### anchor1 anchor1(): Vector The position of the first anchor of this joint. The first anchor gives the position of the application point on the local frame of the first rigid-body it is attached to. #### Returns Vector ### anchor2 anchor2(): Vector The position of the second anchor of this joint. The second anchor gives the position of the application point on the local frame of the second rigid-body it is attached to. #### Returns Vector ### body1 body1(): RigidBody The first rigid-body this joint it attached to. #### Returns RigidBody ### body2 body2(): RigidBody The second rigid-body this joint is attached to. #### Returns RigidBody ### contactsEnabled contactsEnabled(): boolean Indicates if contacts are enabled between colliders attached to the rigid-bodies linked by this joint. #### Returns boolean ### finalizeDeserialization `Internal` finalizeDeserialization(bodySet): void #### Parameters * **bodySet** (RigidBodySet) - The rigid body set. #### Returns void ### isValid isValid(): boolean Checks if this joint is still valid (i.e. that it has not been deleted from the joint set yet). #### Returns boolean ### setAnchor1 setAnchor1(newPos): void Sets the position of the first anchor of this joint. The first anchor gives the position of the application point on the local frame of the first rigid-body it is attached to. #### Parameters * **newPos** (Vector) - The new position for the anchor. #### Returns void ### setAnchor2 setAnchor2(newPos): void Sets the position of the second anchor of this joint. The second anchor gives the position of the application point on the local frame of the second rigid-body it is attached to. #### Parameters * **newPos** (Vector) - The new position for the anchor. #### Returns void ### setContactsEnabled setContactsEnabled(enabled): void Controls whether contacts are computed between colliders attached to the rigid-bodies linked by this joint. #### Parameters * **enabled** (boolean) - Whether to enable contacts. #### Returns void ### type type(): JointType The type of this joint given as a string. #### Returns JointType ``` -------------------------------- ### UnitImpulseJoint Constructor Source: https://rapier.rs/javascript2d/classes/UnitImpulseJoint.html Constructs a new UnitImpulseJoint instance. ```APIDOC ## new UnitImpulseJoint ### Description Constructs a new UnitImpulseJoint. ### Parameters * **rawSet** (RawImpulseJointSet) - The raw set of impulse joints. * **bodySet** (RigidBodySet) - The set of rigid bodies. * **handle** (number) - The handle of the joint. ### Returns UnitImpulseJoint ``` -------------------------------- ### World.numSolverIterations Source: https://rapier.rs/javascript2d/classes/World.html Gets or sets the number of solver iterations run by the constraints solver for calculating forces. The greater this value is, the more rigid and realistic the physics simulation will be. ```APIDOC ## World.numSolverIterations ### Description Gets or sets the number of solver iterations run by the constraints solver for calculating forces. The greater this value is, the more rigid and realistic the physics simulation will be. ### Getter * **numSolverIterations**(): number * Returns the current number of solver iterations. ### Setter * **numSolverIterations**(niter: number): void * Sets the number of solver iterations. * **Parameters**: * niter (number) - The new number of solver iterations. ``` -------------------------------- ### RayColliderHit Constructor Source: https://rapier.rs/javascript2d/classes/RayColliderHit.html Constructs a new RayColliderHit instance. ```APIDOC ## constructor ### Description Creates a new RayColliderHit. ### Signature `new RayColliderHit(collider: Collider, timeOfImpact: number): RayColliderHit` ### Parameters * **collider** (Collider) - The handle of the collider hit by the ray. * **timeOfImpact** (number) - The time-of-impact of the ray with the collider. The hit point is obtained from the ray's origin and direction: `origin + dir * timeOfImpact`. ``` -------------------------------- ### timingVelocityResolution Source: https://rapier.rs/javascript2d/classes/World.html Gets the time spent in milliseconds by the last step to run the constraint resolution. This timing is included in `timingSolver`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`. ```APIDOC ## timingVelocityResolution ### Description The time spent in milliseconds by the last step to run the constraint resolution. This timing is included in `timingSolver`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`. ### Method `timingVelocityResolution()` ### Returns number - The time in milliseconds. ``` -------------------------------- ### projectPoint Source: https://rapier.rs/javascript2d/classes/HalfSpace.html Projects a point onto the half-space. ```APIDOC ## projectPoint ### Description Projects a point onto the half-space. ### Parameters * **shapePos** (Vector) - The position of the half-space. * **shapeRot** (number) - The rotation of the half-space. * **point** (Vector) - The point to project. * **solid** (boolean) - Whether the half-space is considered solid. ### Returns PointProjection - Information about the projected point. ``` -------------------------------- ### restoreSnapshot Source: https://rapier.rs/javascript2d/classes/World.html Creates a new physics world from a snapshot. This new physics world will be an identical copy of the snapshoted physics world. ```APIDOC ## restoreSnapshot ### Description Creates a new physics world from a snapshot. This new physics world will be an identical copy of the snapshoted physics world. ### Method `World.restoreSnapshot(data)` ### Parameters #### Path Parameters - **data** (Uint8Array) - The snapshot data. ``` -------------------------------- ### timingVelocityUpdate Source: https://rapier.rs/javascript2d/classes/World.html Gets the time spent in milliseconds by the last step to run the rigid-body velocity update. This timing is included in `timingSolver`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`. ```APIDOC ## timingVelocityUpdate ### Description The time spent in milliseconds by the last step to run the rigid-body velocity update. This timing is included in `timingSolver`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`. ### Method `timingVelocityUpdate()` ### Returns number - The time in milliseconds. ``` -------------------------------- ### PointProjection.fromRaw Source: https://rapier.rs/javascript2d/classes/PointProjection.html Creates a PointProjection from a raw object. ```APIDOC ## `Static` fromRaw(raw) ### Description Creates a PointProjection from a raw object. ### Parameters #### Parameters - **raw** (RawPointProjection) - The raw object to create the PointProjection from. #### Returns PointProjection ``` -------------------------------- ### dynamic Source: https://rapier.rs/javascript2d/classes/RigidBodyDesc.html Creates a rigid-body descriptor for a dynamic rigid-body. ```APIDOC ## dynamic ### Description A rigid-body descriptor used to build a dynamic rigid-body. ### Method dynamic ### Returns RigidBodyDesc ```