import "@babylonjs/core/Physics/v2/physicsEngineComponent"; import { Matrix } from "@babylonjs/core/Maths/math.vector"; import type { Mesh } from "@babylonjs/core/Meshes/mesh"; import { TransformNode } from "@babylonjs/core/Meshes/transformNode"; import { PhysicsBody } from "@babylonjs/core/Physics/v2/physicsBody"; import type { PhysicsConstraint } from "@babylonjs/core/Physics/v2/physicsConstraint"; import type { Scene } from "@babylonjs/core/scene"; import type { Nullable } from "@babylonjs/core/types"; import { PmxObject } from "../Loader/Parser/pmxObject"; import type { ILogger } from "./ILogger"; import type { MmdRuntimeBone } from "./mmdRuntimeBone"; declare class MmdPhysicsTransformNode extends TransformNode { readonly linkedBone: MmdRuntimeBone; physicsMode: PmxObject.RigidBody.PhysicsMode; readonly bodyOffsetMatrix: Matrix; readonly bodyOffsetInverseMatrix: Matrix; constructor(name: string, scene: Scene, linkedBone: MmdRuntimeBone, physicsMode: PmxObject.RigidBody.PhysicsMode, isPure?: boolean); private static readonly _ParentWorldMatrixInverse; private static readonly _WorldMatrix; computeBodyOffsetMatrix(): void; } /** * MMD physics model is container of the physics resources of the MMD model */ export declare class MmdPhysicsModel { private readonly _mmdPhysics; private readonly _nodes; private readonly _bodies; private readonly _constraints; /** * Create a new MMD physics model * @param mmdPhysics MMD physics * @param nodes MMD physics transform nodes * @param bodies Physics bodies * @param constraints Physics constraints */ constructor(mmdPhysics: MmdPhysics, nodes: readonly Nullable[], bodies: readonly Nullable[], constraints: readonly Nullable[]); /** * Dispose the physics resources */ dispose(): void; private static readonly _NodeWorldMatrix; private static readonly _ZeroVector; /** * Reset the rigid body positions and velocities */ initialize(): void; private static readonly _NodeWorldPosition; private static readonly _NodeWorldRotation; /** * Set the rigid bodies transform to the bones transform */ syncBodies(): void; private static readonly _BoneWorldPosition; /** * Set the bones transform to the rigid bodies transform */ syncBones(): void; } /** * Use the v2 physics engine to build the physics model of the MMD model * * If you do not want to use a physics engine, you can reduce the bundling size by not import this class */ export declare class MmdPhysics { /** * Set a threshold in radian to clamp the constraint's angular limit to 0 (default: 5 * Math.PI / 180) * * If your model's constraints have an odd bend, try increasing the value appropriately. * * A value of 5 * Math.PI / 180 to 30 * Math.PI / 180 is expected to work well. */ angularLimitClampThreshold: number; private readonly _scene; private readonly _enablePreStepOnces; /** * Create a new MMD physics * * Scene must have a physics engine enabled * @param scene The scene to build the physics model */ constructor(scene: Scene); private _convertParameter; private _clampAngularLimit; /** * Build the physics model of the MMD model * @param mesh Mesh * @param bones MMD runtime bones * @param rigidBodies rigid bodies information * @param joints joints information * @param logger Logger * @returns MMD physics model */ buildPhysics(mesh: Mesh, bones: readonly MmdRuntimeBone[], rigidBodies: PmxObject["rigidBodies"], joints: PmxObject["joints"], logger: ILogger): MmdPhysicsModel; private readonly _onAfterPhysics; /** @internal */ _enablePreStepOnce(body: PhysicsBody): void; } export {};