Added missing methods to Body.

This commit is contained in:
Shu Sam Chen
2017-01-10 17:22:16 +00:00
parent d22bd22f74
commit 92933ca5fc
2 changed files with 10 additions and 1 deletions

5
p2/index.d.ts vendored
View File

@@ -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?: {

View File

@@ -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(){