@threlte/rapier
Version:
Components and hooks to use the Rapier physics engine in Threlte
15 lines (14 loc) • 826 B
TypeScript
import type { RigidBody } from '@dimforge/rapier3d-compat';
import type { Object3D } from 'three';
export type ExtractMethods<ObjectType> = Pick<ObjectType, {
[Method in keyof ObjectType]: ObjectType[Method] extends (...args: any[]) => any ? Method : never;
}[keyof ObjectType]>;
/**
* When using a fixed framerate, Threlte is interpolating the position and
* rotation of RigidBody objects. Sometimes, this is not desirable, especially
* when using methods on the rigidbody that teleport the object, e.g. should
* lead to a sudden change in translation/rotation such as `rb.setTranslation`.
* These methods are overridden to reset the physics simulation position and
* rotation to the current object position and rotation.
*/
export declare const overrideTeleportMethods: (rb: RigidBody, object: Object3D) => void;