From 92933ca5fc28c42957d83ca013ac717c75c64252 Mon Sep 17 00:00:00 2001 From: Shu Sam Chen Date: Tue, 10 Jan 2017 17:22:16 +0000 Subject: [PATCH] Added missing methods to Body. --- p2/index.d.ts | 5 ++++- p2/p2-tests.ts | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/p2/index.d.ts b/p2/index.d.ts index 5fb85052e6..e9b8b79054 100644 --- a/p2/index.d.ts +++ b/p2/index.d.ts @@ -520,7 +520,10 @@ declare namespace p2 { addShape(shape: Shape, offset?: number[], angle?: number): void; removeShape(shape: Shape): boolean; updateMassProperties(): void; - applyForce(force: number[], worldPoint: number[]): void; + applyForce(force: number[], relativePoint?: number[]): void; + applyForceLocal(localforce: number[], localPoint?: number[]): void; + applyImpulse(impulse: number[], relativePoint?: number[]): void; + applyImpulseLocal(impulse: number[], localPoint?: number[]): void; toLocalFrame(out: number[], worldPoint: number[]): void; toWorldFrame(out: number[], localPoint: number[]): void; fromPolygon(path: number[][], options?: { diff --git a/p2/p2-tests.ts b/p2/p2-tests.ts index bdad71b906..0579a880b2 100644 --- a/p2/p2-tests.ts +++ b/p2/p2-tests.ts @@ -31,6 +31,12 @@ world.addBody(groundBody); // This is done using a fixed time step size. var timeStep = 1 / 60; // seconds +// Apply a force to the circle +circleBody.applyForce([10, 0]); + +// Apply an impulse to the circle +circleBody.applyImpulse([0, 50]); + // The "Game loop". Could be replaced by, for example, requestAnimationFrame. setInterval(function(){