2d-physics-engine
Version:
A lightweight, flexible 2D physics engine with ECS architecture, built with TypeScript
36 lines • 1.04 kB
TypeScript
import { Vector2 } from '../math/Vector2';
import { Component } from './Component.abstract';
interface RigidbodyOptions {
mass?: number;
restitution?: number;
friction?: number;
}
export declare class Rigidbody extends Component {
readonly componentId: symbol;
private velocity;
private angularVelocity;
private forces;
private torque;
private mass;
private inertia;
private restitution;
private friction;
constructor(options?: RigidbodyOptions);
update(): void;
getVelocity(): Vector2;
setVelocity(velocity: Vector2): void;
getAngularVelocity(): number;
setAngularVelocity(angularVelocity: number): void;
getMass(): number;
getInverseMass(): number;
getInertia(): number;
getAccumulatedForces(): Vector2;
getTorque(): number;
addForce(force: Vector2): void;
addTorque(torque: number): void;
clearForces(): void;
getRestitution(): number;
getFriction(): number;
}
export {};
//# sourceMappingURL=Rigidbody.component.d.ts.map