Files
Webklar.com/node_modules/@dimforge/rapier3d-compat/geometry/narrow_phase.d.ts
Basilosaurusrex f027651f9b main repo
2025-11-24 18:09:40 +01:00

72 lines
3.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { RawNarrowPhase, RawContactManifold } from "../raw";
import { ColliderHandle } from "./collider";
import { Vector } from "../math";
/**
* The narrow-phase used for precise collision-detection.
*
* To avoid leaking WASM resources, this MUST be freed manually with `narrowPhase.free()`
* once you are done using it.
*/
export declare class NarrowPhase {
raw: RawNarrowPhase;
tempManifold: TempContactManifold;
/**
* Release the WASM memory occupied by this narrow-phase.
*/
free(): void;
constructor(raw?: RawNarrowPhase);
/**
* Enumerates all the colliders potentially in contact with the given collider.
*
* @param collider1 - The second collider involved in the contact.
* @param f - Closure that will be called on each collider that is in contact with `collider1`.
*/
contactPairsWith(collider1: ColliderHandle, f: (collider2: ColliderHandle) => void): void;
/**
* Enumerates all the colliders intersecting the given colliders, assuming one of them
* is a sensor.
*/
intersectionPairsWith(collider1: ColliderHandle, f: (collider2: ColliderHandle) => void): void;
/**
* Iterates through all the contact manifolds between the given pair of colliders.
*
* @param collider1 - The first collider involved in the contact.
* @param collider2 - The second collider involved in the contact.
* @param f - Closure that will be called on each contact manifold between the two colliders. If the second argument
* passed to this closure is `true`, then the contact manifold data is flipped, i.e., methods like `localNormal1`
* actually apply to the `collider2` and fields like `localNormal2` apply to the `collider1`.
*/
contactPair(collider1: ColliderHandle, collider2: ColliderHandle, f: (manifold: TempContactManifold, flipped: boolean) => void): void;
/**
* Returns `true` if `collider1` and `collider2` intersect and at least one of them is a sensor.
* @param collider1 The first collider involved in the intersection.
* @param collider2 The second collider involved in the intersection.
*/
intersectionPair(collider1: ColliderHandle, collider2: ColliderHandle): boolean;
}
export declare class TempContactManifold {
raw: RawContactManifold;
free(): void;
constructor(raw: RawContactManifold);
normal(): Vector;
localNormal1(): Vector;
localNormal2(): Vector;
subshape1(): number;
subshape2(): number;
numContacts(): number;
localContactPoint1(i: number): Vector | null;
localContactPoint2(i: number): Vector | null;
contactDist(i: number): number;
contactFid1(i: number): number;
contactFid2(i: number): number;
contactImpulse(i: number): number;
contactTangentImpulseX(i: number): number;
contactTangentImpulseY(i: number): number;
numSolverContacts(): number;
solverContactPoint(i: number): Vector;
solverContactDist(i: number): number;
solverContactFriction(i: number): number;
solverContactRestitution(i: number): number;
solverContactTangentVelocity(i: number): Vector;
}