import { Steppable } from '../loopables'; import { KinematicQuantity } from './KinematicQuantity'; /** * (To be filled) */ export declare class PhysicsBody implements Steppable { /** * Kinematic quantity. */ readonly kinematicQuantity: KinematicQuantity; /** * Shortcut to kinematicQuantity.position. */ readonly position: p5.Vector; /** * Shortcut to kinematicQuantity.velocity. */ readonly velocity: p5.Vector; /** * The mass of the body. */ mass: number; /** * Radius of the body which will be used for collision detection. */ collisionRadius: number; private hasFriction; private decelerationFactor; constructor(); /** * X position. */ readonly x: number; /** * Y position. */ readonly y: number; /** * Z position. */ readonly z: number; /** * X velocity. */ readonly vx: number; /** * Y velocity. */ readonly vy: number; /** * Z velocity. */ readonly vz: number; /** * Returns the current speed. */ getSpeed(): number; /** * Returns the current direction angle. */ getDirection(): number; /** * Sets the friction of the body. * @param constant */ setFriction(constant: number): void; /** * Constrains the current speed. Should be called every time if needed. * @param maxSpeed */ constrainSpeed(maxSpeed: number): void; /** * Updates the body. */ step(): void; /** * Accelerates the body. * @param x * @param y * @param z */ accelerate(x: number, y: number, z?: number): void; /** * Apply the provided force to the body. * @param force */ applyForce(force: p5.Vector): void; /** * Add the provided value to the speed of the body. * @param speedChange */ addSpeed(speedChange: number): void; /** * Returns true if the body collides the provided body. * @param other */ collides(other: PhysicsBody): boolean; /** * (To be filled) * @param normalUnitVector * @param restitution */ bounce(normalUnitVector: p5.Vector, restitution?: number): void; /** * Applies attraction force to both this and the target body. * @param {PhysicsBody} other - the other body to interact with * @param {number} magnitudeFactor - the factor of magnitude other than the distance * @param {number} minMag - the minimum magnitude * @param {number} maxMag - the maximum magnitude * @param {number} cutoffMag - does not apply force if magnitude is smaller than this */ attractEachOther(other: PhysicsBody, magnitudeFactor: number, minMag?: number, maxMag?: number, cutoffMag?: number): void; /** * Applies attraction force to this body. * @param {p5.Vector} targetPosition - the target position * @param {number} magnitudeFactor - the factor of magnitude other than the distance * @param {number} minMag - the minimum magnitude * @param {number} maxMag - the maximum magnitude * @param {number} cutoffMag - does not apply force if magnitude is smaller than this */ attractToPoint(targetPosition: p5.Vector, magnitudeFactor: number, minMag?: number, maxMag?: number, cutoffMag?: number): void; private calculateAttractionForce; }