From 96d73c7256246180e1dbad742acf3715dcfd1b4e Mon Sep 17 00:00:00 2001 From: Grzegorz Rozdzialik Date: Thu, 21 Dec 2017 21:41:05 +0100 Subject: [PATCH 1/2] cannon: add cone twist constraint --- types/cannon/index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/types/cannon/index.d.ts b/types/cannon/index.d.ts index 8516d968dd..ccb9c6541f 100644 --- a/types/cannon/index.d.ts +++ b/types/cannon/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for cannon 0.1 // Project: https://github.com/clark-stevenson/cannon.d.ts // Definitions by: Clark Stevenson +// Grzegorz Rozdzialik // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -148,6 +149,8 @@ declare module CANNON { constructor(bodyA: Body, bodyB: Body, options?: IConstraintOptions); update(): void; + disable(): void; + enable(): void; } @@ -193,6 +196,19 @@ declare module CANNON { constructor(bodyA: Body, bodyB: Body, options?:any); } + export interface IConeTwistConstraintOptions { + pivotA?: Vec3; + pivotB?: Vec3; + axisA?: Vec3; + axisB?: Vec3; + maxForce?: number; + } + + export class ConeTwistConstraint extends Constraint { + constructor(bodyA: Body, bodyB: Body, options?: IConeTwistConstraintOptions); + + } + export class Equation { From 9e8b85a964b076d8648b4b06780d96dd87e55f36 Mon Sep 17 00:00:00 2001 From: Grzegorz Rozdzialik Date: Thu, 21 Dec 2017 21:48:23 +0100 Subject: [PATCH 2/2] cannon: fill AABB and ArrayCollisionMatrix classes, add proper LockConstraint constructor options --- types/cannon/index.d.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/types/cannon/index.d.ts b/types/cannon/index.d.ts index ccb9c6541f..56272a6b1f 100644 --- a/types/cannon/index.d.ts +++ b/types/cannon/index.d.ts @@ -21,10 +21,14 @@ declare module CANNON { constructor(options?: IAABBOptions); - setFromPoints(points: Vec3[], position?: Vec3, quaternion?: Quaternion, skinSize?: number): void; + clone(): AABB; copy(aabb: AABB): void; extend(aabb: AABB): void; + getCorners(a: Vec3, b: Vec3, c: Vec3, d: Vec3, e: Vec3, f: Vec3, g: Vec3, h: Vec3): void; overlaps(aabb: AABB): boolean; + setFromPoints(points: Vec3[], position?: Vec3, quaternion?: Quaternion, skinSize?: number): AABB; + toLocalFrame(frame: Transform, target: AABB): AABB; + toWorldFrame(frame: Transform, target: AABB): AABB; } @@ -33,7 +37,7 @@ declare module CANNON { matrix: Mat3[]; get(i: number, j: number): number; - set(i: number, j: number, value?: number): void; + set(i: number, j: number, value: number): void; reset(): void; setNumObjects(n: number): void; @@ -191,9 +195,12 @@ declare module CANNON { } + export interface ILockConstraintOptions { + maxForce?: number; + } export class LockConstraint extends Constraint { - constructor(bodyA: Body, bodyB: Body, options?:any); + constructor(bodyA: Body, bodyB: Body, options?: ILockConstraintOptions); } export interface IConeTwistConstraintOptions { @@ -206,7 +213,6 @@ declare module CANNON { export class ConeTwistConstraint extends Constraint { constructor(bodyA: Body, bodyB: Body, options?: IConeTwistConstraintOptions); - }