import { Component, GameObject, IVec2, ChibiEvent } from "chibiengine"; import Shape from "../shapes/Shape"; import Fixture from "../fixture/Fixture"; import Filter from "../fixture/Filter"; import Contact from "../contact/Contact"; import Manifold from "../contact/Manifold"; import ContactImpulse from "../contact/ContactImpulse"; export type BodyType = "static" | "dynamic" | "kinematic"; interface PhysicsBodyOptions { type?: BodyType; offset?: IVec2; } export default class PhysicsBody extends Component<"body"> { static readonly BODIES: Map; readonly componentName: "body"; private target; b2Body: Box2D.b2Body; private offset; private world; private fixtures; private bodyType; onBeginContact: ChibiEvent<[Contact]>; onEndContact: ChibiEvent<[Contact]>; onPreSolve: ChibiEvent<[Contact, Manifold]>; onPostSolve: ChibiEvent<[Contact, ContactImpulse]>; get box2D(): Box2D.b2Body; constructor(shape?: Shape, options?: PhysicsBodyOptions); private getParentWorld; apply(target: GameObject): Promise; destroy(): Promise; syncPosition(): void; createFixture(shape: Shape, modifier: (fx: Fixture) => void): this; createFixture(shape: Shape): Fixture; createCircle(center: IVec2, radius: number): Fixture; createEdge(v1: IVec2, v2: IVec2, ghostv0?: IVec2, ghostv3?: IVec2): Fixture; createChain(vertices: IVec2[], prevVertex?: IVec2, nextVertex?: IVec2): Fixture; createBox(width: number, height: number, center?: IVec2): Fixture; createPolygon(vertices: IVec2[]): Fixture; setType(type: BodyType): this; getType(): BodyType; setDensity(density: number): this; setFriction(friction: number): this; setRestitution(restitution: number): this; setRestitutionThreshold(restitutionThreshold: number): this; setFilter(filter: Filter): this; setAwake(awake: boolean): this; setStatic(): this; setDynamic(): this; setKinematic(): this; private bindEvent; static getBody(b2Body: Box2D.b2Body): PhysicsBody; } export {};