Merge pull request #22439 from Gelio/cannonjs

[@types/cannon] Fill in existing types, add ConeTwistConstraint
This commit is contained in:
Paul van Brenk
2017-12-28 14:34:45 -08:00
committed by GitHub
+25 -3
View File
@@ -1,6 +1,7 @@
// Type definitions for cannon 0.1
// Project: https://github.com/clark-stevenson/cannon.d.ts
// Definitions by: Clark Stevenson <https://github.com/clark-stevenson>
// Grzegorz Rozdzialik <https://github.com/Gelio>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -20,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;
}
@@ -32,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;
@@ -148,6 +153,8 @@ declare module CANNON {
constructor(bodyA: Body, bodyB: Body, options?: IConstraintOptions);
update(): void;
disable(): void;
enable(): void;
}
@@ -188,9 +195,24 @@ 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 {
pivotA?: Vec3;
pivotB?: Vec3;
axisA?: Vec3;
axisB?: Vec3;
maxForce?: number;
}
export class ConeTwistConstraint extends Constraint {
constructor(bodyA: Body, bodyB: Body, options?: IConeTwistConstraintOptions);
}