/** * PhysicsBody.ts * * Rigid body implementation for the HoloScript physics system. * * @module physics */ import { IVector3, IQuaternion, ITransform, IRigidBodyConfig, IRigidBodyState, IPhysicsMaterial, ICollisionFilter, CollisionShape, BodyType } from './PhysicsTypes'; type AnyVec3 = IVector3 | { x: number; y: number; z: number; }; /** * Rigid body class for physics simulation */ export declare class RigidBody { readonly id: string; readonly type: BodyType; readonly shape: CollisionShape; private _position; private _rotation; private _linearVelocity; private _angularVelocity; private _isSleeping; private _isActive; private _mass; private _inverseMass; private _inertia; private _inverseInertia; private _material; private _filter; private _linearDamping; private _angularDamping; private _gravityScale; private _ccd; private _userData; private _force; private _torque; private _sleepTimer; constructor(config: IRigidBodyConfig); get position(): IVector3; set position(value: IVector3); /** * Apply an internal solver position correction without resetting the sleep * timer. External transform writes must continue to use the public setter so * teleports wake a body; contact stabilization must not wake it every frame. */ setSolverPosition(value: IVector3): void; get rotation(): IQuaternion; set rotation(value: IQuaternion); get linearVelocity(): IVector3; set linearVelocity(value: AnyVec3); get angularVelocity(): IVector3; set angularVelocity(value: AnyVec3); get isSleeping(): boolean; get isActive(): boolean; set isActive(value: boolean); get mass(): number; get inverseMass(): number; /** * Diagonal inverse inertia tensor in body-local space (1/(kg·m²) per axis). * Returns a copy to prevent mutation of internal state. */ get inverseInertia(): IVector3; get material(): IPhysicsMaterial; set material(value: IPhysicsMaterial); get filter(): ICollisionFilter; set filter(value: ICollisionFilter); get gravityScale(): number; set gravityScale(value: number); get ccd(): boolean; set ccd(value: boolean); get userData(): unknown; set userData(value: unknown); /** * Apply a force at the center of mass */ applyForce(force: AnyVec3): void; /** * Apply a force at a world point */ applyForceAtPoint(force: AnyVec3, worldPoint: AnyVec3): void; /** * Apply an impulse at the center of mass */ applyImpulse(impulse: AnyVec3): void; /** * Apply an impulse generated by the contact/constraint solver. * * Resting contacts must not reset the sleep timer on every fixed step. * A meaningful impact still wakes a sleeping body before applying velocity. */ applySolverImpulse(impulse: AnyVec3): void; /** * Apply an impulse at a world point */ applyImpulseAtPoint(impulse: AnyVec3, worldPoint: AnyVec3): void; /** * Apply a torque */ applyTorque(torque: AnyVec3): void; /** * Apply a torque impulse */ applyTorqueImpulse(impulse: AnyVec3): void; /** * Apply an angular impulse generated by the internal solver without * resetting the sleep timer for an already-settling body. */ applySolverTorqueImpulse(impulse: AnyVec3): void; /** * Clear accumulated forces */ clearForces(): void; /** * Integrate forces (semi-implicit Euler) */ integrateForces(dt: number, gravity: AnyVec3): void; /** * Integrate velocities (update position/rotation) */ integrateVelocities(dt: number): void; /** * Wake up the body */ wakeUp(): void; /** * Try to put the body to sleep */ updateSleep(dt: number): void; /** * Get current state */ getState(): IRigidBodyState; /** * Get transform */ getTransform(): ITransform; /** * Set transform directly (for kinematic bodies) */ setTransform(transform: ITransform): void; /** * Get accumulated force */ getForce(): IVector3; /** * Get accumulated torque */ getTorque(): IVector3; /** * Calculate inertia tensor for the shape */ private calculateInertia; /** * Clamp velocity magnitude */ private clampVelocity; /** * Calculate vector length */ private vectorLength; /** * Normalize quaternion */ private normalizeQuaternion; /** * Test collision filter */ canCollideWith(other: RigidBody): boolean; } export {}; //# sourceMappingURL=PhysicsBody.d.ts.map