import type { Vector3 } from "@babylonjs/core/Maths/math.vector"; import type { DeepImmutable } from "@babylonjs/core/types"; import type { Constraint } from "./constraint"; import type { IPhysicsRuntime } from "./Impl/IPhysicsRuntime"; import type { RigidBody } from "./rigidBody"; import type { RigidBodyBundle } from "./rigidBodyBundle"; /** * PhysicsWorld handles the simulation of physics in the Bullet engine * * It is responsible for managing the simulation step, gravity, and the rigid bodies and constraints in the world */ export declare class PhysicsWorld { private readonly _runtime; private readonly _inner; /** * Creates a new physics world * @param runtime The physics runtime that this world belongs to */ constructor(runtime: IPhysicsRuntime); /** * Disposes the physics world */ dispose(): void; /** * @internal */ get ptr(): number; /** * @internal */ addReference(): void; /** * @internal */ removeReference(): void; private _nullCheck; /** * Sets the gravity of the physics world * * This operation performs waiting for the lock before executing * @param gravity The gravity vector to set */ setGravity(gravity: DeepImmutable): void; /** * Steps the simulation of the physics world * @param timeStep The time step to use for the simulation * @param maxSubSteps The maximum number of substeps to use for the simulation * @param fixedTimeStep The fixed time step to use for the simulation */ stepSimulation(timeStep: number, maxSubSteps: number, fixedTimeStep: number): void; /** * Adds a rigid body to the physics world * * This operation performs waiting for the lock before executing * @param rigidBody The rigid body to add * @returns True if the rigid body was added successfully, false otherwise */ addRigidBody(rigidBody: RigidBody): boolean; /** * Removes a rigid body from the physics world * * This operation performs waiting for the lock before executing * @param rigidBody The rigid body to remove * @returns True if the rigid body was removed successfully, false otherwise */ removeRigidBody(rigidBody: RigidBody): boolean; /** * Adds a rigid body bundle to the physics world * * This operation performs waiting for the lock before executing * @param rigidBodyBundle The rigid body bundle to add * @returns True if the rigid body bundle was added successfully, false otherwise */ addRigidBodyBundle(rigidBodyBundle: RigidBodyBundle): boolean; /** * Removes a rigid body bundle from the physics world * * This operation performs waiting for the lock before executing * @param rigidBodyBundle The rigid body bundle to remove * @returns True if the rigid body bundle was removed successfully, false otherwise */ removeRigidBodyBundle(rigidBodyBundle: RigidBodyBundle): boolean; /** * Adds a constraint to the physics world * * This operation performs waiting for the lock before executing * @param constraint The constraint to add * @param disableCollisionsBetweenLinkedBodies Whether to disable collisions between linked bodies * @returns True if the constraint was added successfully, false otherwise */ addConstraint(constraint: Constraint, disableCollisionsBetweenLinkedBodies: boolean): boolean; /** * Removes a constraint from the physics world * * This operation performs waiting for the lock before executing * @param constraint The constraint to remove * @returns True if the constraint was removed successfully, false otherwise */ removeConstraint(constraint: Constraint): boolean; }