UNPKG

babylon-mmd

Version:
97 lines (96 loc) 3.39 kB
import { Matrix, Vector3 } from "@babylonjs/core/Maths/math.vector"; import type { PhysicsImpostorJoint } from "@babylonjs/core/Physics/v1/IPhysicsEnginePlugin"; import { PhysicsJoint, type PhysicsJointData } from "@babylonjs/core/Physics/v1/physicsJoint"; import { AmmoJSPlugin } from "@babylonjs/core/Physics/v1/Plugins/ammoJSPlugin"; export declare const Generic6DofSpringJointKind = 20; /** * AmmoJS Physics plugin modified for MMD * * 120 steps per second is recommended for better reproduction of MMD physics. but performance reasons default is 60 steps per second. * * for better reproduction of MMD physics, you can set the following parameters: * ```javascript * plugin.setMaxSteps(120); * plugin.setFixedTimeStep(1 / 120); * ``` */ export declare class MmdAmmoJSPlugin extends AmmoJSPlugin { private readonly _mmdtmpAmmoVector; private readonly _mmdtmpAmmoQuat; private readonly _mmdtmpAmmoTransformA; private readonly _mmdtmpAmmoTransformB; private static readonly _BjsQuaternion; /** * If true, the offset for the constraint frame is forcibly disabled. (Default: false) * * This is useful for reproducing the behavior of MMD physics. * But the constraint can be broken if the offset is forcibly disabled. */ forceDisableOffsetForConstraintFrame: boolean; /** * Initializes the ammoJS plugin * @param _useDeltaForWorldStep if the time between frames should be used when calculating physics steps (Default: true) * @param ammoInjection can be used to inject your own ammo reference * @param overlappingPairCache can be used to specify your own overlapping pair cache */ constructor(useDeltaForWorldStep: boolean | undefined, ammoInjection: any, overlappingPairCache?: any); dispose(): void; private _stepSimulation; private _normalizeAngle; /** * Generates a joint * @param impostorJoint the imposter joint to create the joint with */ generateJoint(impostorJoint: PhysicsImpostorJoint): void; } /** * Represents a Generic6DofSpringJoint */ export declare class Generic6DofSpringJoint extends PhysicsJoint { /** * Initializes the Generic6DofSpringJoint * @param jointData The physical joint data for the joint */ constructor(jointData: IGeneric6DofSpringJointData); } /** * Interface for a generic 6 DOF spring joint */ export interface IGeneric6DofSpringJointData extends PhysicsJointData { /** * The main local axis of the joint in the first body's local space. */ mainFrame: Matrix; /** * The connected local axis of the joint in the second body's local space. */ connectedFrame: Matrix; /** * if true, the linear reference frame is mainFrame, otherwise it is connectedFrame. */ useLinearReferenceFrameA: boolean; /** * The linear lower limit of the joint. */ linearLowerLimit?: Vector3; /** * The linear upper limit of the joint. */ linearUpperLimit?: Vector3; /** * The angular lower limit of the joint. */ angularLowerLimit?: Vector3; /** * The angular upper limit of the joint. */ angularUpperLimit?: Vector3; /** * The linear stiffness of the joint. */ linearStiffness?: Vector3; /** * The angular stiffness of the joint. */ angularStiffness?: Vector3; }