mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
383
cannon/index.d.ts
vendored
383
cannon/index.d.ts
vendored
@@ -3,6 +3,7 @@
|
||||
// Definitions by: Clark Stevenson <https://github.com/clark-stevenson>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare module CANNON {
|
||||
|
||||
export interface IAABBOptions {
|
||||
@@ -19,14 +20,11 @@ declare module CANNON {
|
||||
|
||||
constructor(options?: IAABBOptions);
|
||||
|
||||
clone() : AABB;
|
||||
setFromPoints(points: Vec3[], position?: Vec3, quaternion?: Quaternion, skinSize?: number): void;
|
||||
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;
|
||||
toLocalFrame( frame: Transform, target: AABB ) : AABB;
|
||||
toWorldFrame( frame: Transform, target: AABB ) : AABB;
|
||||
|
||||
}
|
||||
|
||||
export class ArrayCollisionMatrix {
|
||||
@@ -40,7 +38,7 @@ declare module CANNON {
|
||||
|
||||
}
|
||||
|
||||
export class Broadphase {
|
||||
export class BroadPhase {
|
||||
|
||||
world: World;
|
||||
useBoundingBoxes: boolean;
|
||||
@@ -58,7 +56,7 @@ declare module CANNON {
|
||||
|
||||
}
|
||||
|
||||
export class GridBroadphase extends Broadphase {
|
||||
export class GridBroadphase extends BroadPhase {
|
||||
|
||||
nx: number;
|
||||
ny: number;
|
||||
@@ -71,7 +69,7 @@ declare module CANNON {
|
||||
|
||||
}
|
||||
|
||||
export class NaiveBroadphase extends Broadphase {
|
||||
export class NaiveBroadphase extends BroadPhase {
|
||||
}
|
||||
|
||||
export class ObjectCollisionMatrix {
|
||||
@@ -85,42 +83,16 @@ declare module CANNON {
|
||||
|
||||
}
|
||||
|
||||
export interface IRayIntersectWorldOptions {
|
||||
|
||||
mode: number;
|
||||
result: boolean;
|
||||
skipBackfaces: boolean;
|
||||
collisionFilterMask: number;
|
||||
collisionFilterGroup: number;
|
||||
from: Vec3;
|
||||
to: Vec3;
|
||||
callback: Function;
|
||||
|
||||
}
|
||||
|
||||
export class Ray {
|
||||
|
||||
static CLOSEST: number;
|
||||
static ANY: number;
|
||||
static ALL: number;
|
||||
|
||||
from: Vec3;
|
||||
to: Vec3;
|
||||
precision: number;
|
||||
checkCollisionResponse: boolean;
|
||||
callback: Function;
|
||||
collisionFilterGroup: number;
|
||||
collisionFilterMask: number;
|
||||
hasHit: boolean;
|
||||
mode: number;
|
||||
result: RaycastResult;
|
||||
skipBackfaces: boolean;
|
||||
|
||||
constructor(from?: Vec3, to?: Vec3);
|
||||
|
||||
getAABB(result: RaycastResult): void;
|
||||
intersectBodies(bodies: Body[], result?: RaycastResult): void;
|
||||
intersectWorld(world: World, options: IRayIntersectWorldOptions): boolean;
|
||||
|
||||
}
|
||||
|
||||
@@ -130,19 +102,17 @@ declare module CANNON {
|
||||
rayToWorld: Vec3;
|
||||
hitNormalWorld: Vec3;
|
||||
hitPointWorld: Vec3;
|
||||
hitFaceIndex: number;
|
||||
hasHit: boolean;
|
||||
shape: Shape;
|
||||
body: Body;
|
||||
distance: number;
|
||||
|
||||
abort(): void;
|
||||
reset(): void;
|
||||
set(rayFromWorld: Vec3, rayToWorld: Vec3, hitNormalWorld: Vec3, hitPointWorld: Vec3, shape: Shape, body: Body, distance: number): void;
|
||||
|
||||
}
|
||||
|
||||
export class SAPBroadphase extends Broadphase {
|
||||
export class SAPBroadphase extends BroadPhase {
|
||||
|
||||
static insertionSortX(a: any[]): any[];
|
||||
static insertionSortY(a: any[]): any[];
|
||||
@@ -178,17 +148,12 @@ declare module CANNON {
|
||||
constructor(bodyA: Body, bodyB: Body, options?: IConstraintOptions);
|
||||
|
||||
update(): void;
|
||||
disable(): void;
|
||||
enable(): void;
|
||||
|
||||
}
|
||||
|
||||
export class DistanceConstraint extends Constraint {
|
||||
|
||||
distance: number;
|
||||
distanceEquation: ContactEquation;
|
||||
|
||||
constructor(bodyA: Body, bodyB: Body, distance?: number, maxForce?: number);
|
||||
constructor(bodyA: Body, bodyB: Body, distance: number, maxForce?: number);
|
||||
|
||||
}
|
||||
|
||||
@@ -204,10 +169,6 @@ declare module CANNON {
|
||||
|
||||
export class HingeConstraint extends Constraint {
|
||||
|
||||
axisA: Vec3;
|
||||
axisB: Vec3;
|
||||
rotationalEquation1: RotationalEquation;
|
||||
rotationalEquation2: RotationalEquation;
|
||||
motorEnabled: boolean;
|
||||
motorTargetVelocity: number;
|
||||
motorMinForce: number;
|
||||
@@ -218,41 +179,21 @@ declare module CANNON {
|
||||
|
||||
enableMotor(): void;
|
||||
disableMotor(): void;
|
||||
setMotorMaxForce(maxForce: number): void;
|
||||
setMotorSpeed(speed: number): void;
|
||||
|
||||
}
|
||||
|
||||
export class PointToPointConstraint extends Constraint {
|
||||
|
||||
equationX: ContactEquation;
|
||||
equationY: ContactEquation;
|
||||
equationZ: ContactEquation;
|
||||
pivotA: Vec3;
|
||||
pivotB: Vec3;
|
||||
|
||||
constructor(bodyA: Body, pivotA: Vec3, bodyB: Body, pivotB: Vec3, maxForce?: number);
|
||||
|
||||
}
|
||||
|
||||
export class ConeTwistConstraint extends PointToPointConstraint {
|
||||
|
||||
coneEquation: ConeEquation;
|
||||
twistEquation: RotationalEquation;
|
||||
|
||||
constructor(bodyA: Body, bodyB: Body, options?: IHingeConstraintOptions);
|
||||
|
||||
export class LockConstraint extends Constraint {
|
||||
constructor(bodyA: Body, bodyB: Body, options?:any);
|
||||
}
|
||||
|
||||
export class LockConstraint extends PointToPointConstraint {
|
||||
|
||||
rotationalEquation1: RotationalEquation;
|
||||
rotationalEquation2: RotationalEquation;
|
||||
rotationalEquation3: RotationalEquation;
|
||||
|
||||
constructor(bodyA: Body, bodyB: Body, maxForce?: number);
|
||||
|
||||
}
|
||||
|
||||
export class Equation {
|
||||
|
||||
@@ -279,7 +220,7 @@ declare module CANNON {
|
||||
computeGiMGt(): number;
|
||||
addToWlamda(deltalambda: number): number;
|
||||
computeC(): number;
|
||||
computeInvC( eps: number ): number;
|
||||
|
||||
}
|
||||
|
||||
export class FrictionEquation extends Equation {
|
||||
@@ -288,14 +229,6 @@ declare module CANNON {
|
||||
|
||||
}
|
||||
|
||||
export interface IRotationalEquationOptions {
|
||||
|
||||
axisA?: Vec3;
|
||||
axisB?: Vec3;
|
||||
maxForce?: number;
|
||||
|
||||
}
|
||||
|
||||
export class RotationalEquation extends Equation {
|
||||
|
||||
ni: Vec3;
|
||||
@@ -307,7 +240,7 @@ declare module CANNON {
|
||||
relVel: Vec3;
|
||||
relForce: Vec3;
|
||||
|
||||
constructor(bodyA: Body, bodyB: Body, options?: IRotationalEquationOptions);
|
||||
constructor(bodyA: Body, bodyB: Body);
|
||||
|
||||
}
|
||||
|
||||
@@ -323,33 +256,22 @@ declare module CANNON {
|
||||
|
||||
}
|
||||
|
||||
export interface IConeEquationOptions {
|
||||
|
||||
axisA?: Vec3;
|
||||
axisB?: Vec3;
|
||||
maxForce?: number;
|
||||
|
||||
}
|
||||
|
||||
export class ConeEquation extends Equation {
|
||||
|
||||
angle: number;
|
||||
|
||||
constructor(bodyA: Body, bodyB: Body, options?: IConeEquationOptions);
|
||||
|
||||
}
|
||||
|
||||
export class ContactEquation extends Equation {
|
||||
|
||||
restitution: number;
|
||||
ri: Vec3;
|
||||
rj: Vec3;
|
||||
penetrationVec: Vec3;
|
||||
ni: Vec3;
|
||||
rixn: Vec3;
|
||||
rjxn: Vec3;
|
||||
invIi: Mat3;
|
||||
invIj: Mat3;
|
||||
biInvInertiaTimesRixn: Vec3;
|
||||
bjInvInertiaTimesRjxn: Vec3;
|
||||
|
||||
constructor(bi: Body, bj: Body);
|
||||
|
||||
getImpactVelocityAlongNormal(): number;
|
||||
|
||||
}
|
||||
|
||||
export interface IContactMaterialOptions {
|
||||
@@ -380,12 +302,12 @@ declare module CANNON {
|
||||
|
||||
export class Material {
|
||||
|
||||
id: number;
|
||||
name: string;
|
||||
friction: number;
|
||||
restitution: number;
|
||||
id: number;
|
||||
friction:number;
|
||||
restitution:number;
|
||||
|
||||
constructor(name?: string);
|
||||
constructor(name: string);
|
||||
|
||||
}
|
||||
|
||||
@@ -401,8 +323,6 @@ declare module CANNON {
|
||||
|
||||
export class Mat3 {
|
||||
|
||||
elements: number[];
|
||||
|
||||
constructor(elements?: number[]);
|
||||
|
||||
identity(): void;
|
||||
@@ -423,38 +343,6 @@ declare module CANNON {
|
||||
|
||||
}
|
||||
|
||||
export class Trimesh extends Shape {
|
||||
|
||||
aabb: AABB;
|
||||
edges: number[];
|
||||
indices: number[];
|
||||
normals: number[];
|
||||
scale: Vec3;
|
||||
tree: Octree;
|
||||
vertices: number[];
|
||||
|
||||
static computeNormal(va: Vec3, vb: Vec3, vc: Vec3, target: Vec3): void;
|
||||
static createTorus(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number): Trimesh;
|
||||
|
||||
constructor(vertices: number[], indices: number[]);
|
||||
|
||||
calculateWorldAABB(pos: Vec3, quat: Quaternion, min: Vec3, max: Vec3): void;
|
||||
computeLocalAABB(aabb: AABB): void;
|
||||
getEdgeVector(edgeIndex: number, vectorStore: Vec3): void;
|
||||
getEdgeVertex(edgeIndex: number, firstOrSecond: number, vertexStore: Vec3): void;
|
||||
getNormal(i: number, target: Vec3): Vec3;
|
||||
getTrianglesAABB(aabb: AABB, result: number[]): void;
|
||||
getTriangleVertices(i: number, a: Vec3, b: Vec3, c: Vec3): void;
|
||||
getVertex(i: number, out: Vec3): Vec3;
|
||||
getWorldVertex(i: number, pos: Vec3, quat: Quaternion, out: Vec3): Vec3;
|
||||
setScale(scale: Vec3): void;
|
||||
updateAABB(): void;
|
||||
updateEdges(): void;
|
||||
updateNormals(): void;
|
||||
updateTree(): void;
|
||||
|
||||
}
|
||||
|
||||
export class Quaternion {
|
||||
|
||||
x: number;
|
||||
@@ -487,23 +375,18 @@ declare module CANNON {
|
||||
|
||||
static pointToLocalFrame(position: Vec3, quaternion: Quaternion, worldPoint: Vec3, result?: Vec3): Vec3;
|
||||
static pointToWorldFrame(position: Vec3, quaternion: Quaternion, localPoint: Vec3, result?: Vec3): Vec3;
|
||||
static vectorToWorldFrame(quaternion: Quaternion, localVector: Vec3, result: Vec3): Vec3;
|
||||
static vectorToLocalFrame(position: Vec3, quaternion: Quaternion, worldVector: Vec3, result?: Vec3): Vec3;
|
||||
|
||||
position: Vec3;
|
||||
quaternion: Quaternion;
|
||||
|
||||
pointToLocal(point: Vec3, result: Vec3): Vec3;
|
||||
pointToWorld(point: Vec3, result: Vec3): Vec3;
|
||||
vectorToWorldFrame(localVector: Vec3, result?: Vec3): Vec3;
|
||||
vectorToLocalFrame(position: Vec3, quaternion: Quaternion, worldVector: Vec3, result?: Vec3): Vec3;
|
||||
|
||||
}
|
||||
|
||||
export class Vec3 {
|
||||
|
||||
static ZERO: Vec3;
|
||||
static UNIT_X: Vec3;
|
||||
static UNIT_Y: Vec3;
|
||||
static UNIT_Z: Vec3;
|
||||
|
||||
x: number;
|
||||
y: number;
|
||||
@@ -522,7 +405,6 @@ declare module CANNON {
|
||||
norm(): number;
|
||||
norm2(): number;
|
||||
distanceTo(p: Vec3): number;
|
||||
distanceSquared(p: Vec3): number;
|
||||
mult(scalar: number, target?: Vec3): Vec3;
|
||||
scale(scalar: number, target?: Vec3): Vec3;
|
||||
dot(v: Vec3): number;
|
||||
@@ -532,8 +414,6 @@ declare module CANNON {
|
||||
toString(): string;
|
||||
toArray(): number[];
|
||||
copy(source: Vec3): Vec3;
|
||||
length(): number;
|
||||
lengthSquared(): number;
|
||||
lerp(v: Vec3, t: number, target?: Vec3): void;
|
||||
almostEquals(v: Vec3, precision?: number): boolean;
|
||||
almostZero(precision?: number): boolean;
|
||||
@@ -543,24 +423,15 @@ declare module CANNON {
|
||||
}
|
||||
|
||||
export interface IBodyOptions {
|
||||
|
||||
position?: Vec3;
|
||||
velocity?: Vec3;
|
||||
angularVelocity?: Vec3;
|
||||
quaternion?: Quaternion;
|
||||
mass?: number;
|
||||
material?: Material;
|
||||
material?: number;
|
||||
type?: number;
|
||||
linearDamping?: number;
|
||||
angularDamping?: number;
|
||||
allowSleep?: boolean;
|
||||
sleepSpeedLimit?: number;
|
||||
sleepTimeLimit?: number;
|
||||
collisionFilterGroup?: number;
|
||||
collisionFilterMask?: number;
|
||||
fixedRotation?: boolean;
|
||||
shape?: Shape;
|
||||
|
||||
}
|
||||
|
||||
export class Body extends EventTarget {
|
||||
@@ -585,7 +456,6 @@ declare module CANNON {
|
||||
position: Vec3;
|
||||
previousPosition: Vec3;
|
||||
initPosition: Vec3;
|
||||
boundingRadius: number;
|
||||
velocity: Vec3;
|
||||
initVelocity: Vec3;
|
||||
force: Vec3;
|
||||
@@ -626,24 +496,30 @@ declare module CANNON {
|
||||
wakeUp(): void;
|
||||
sleep(): void;
|
||||
sleepTick(time: number): void;
|
||||
updateSolveMassProperties(): void;
|
||||
pointToLocalFrame(worldPoint: Vec3, result?: Vec3): Vec3;
|
||||
pointToWorldFrame(localPoint: Vec3, result?: Vec3): Vec3;
|
||||
vectorToLocalFrame(worldPoint: Vec3, result?: Vec3): Vec3;
|
||||
vectorToWorldFrame(localVector: Vec3, result?: Vec3): Vec3;
|
||||
addShape(shape: Shape, offset?: Vec3, orientation?: Vec3): void;
|
||||
addShape(shape: Shape, offset?: Vec3, orientation?: Quaternion): void;
|
||||
updateBoundingRadius(): void;
|
||||
computeAABB(): void;
|
||||
updateInertiaWorld(force: Vec3): void;
|
||||
applyForce(force: Vec3, worldPoint: Vec3): void;
|
||||
applyImpulse(impulse: Vec3, worldPoint: Vec3): void;
|
||||
applyLocalForce(force: Vec3, localPoint: Vec3): void;
|
||||
applyLocalImplse(impulse: Vec3, localPoint: Vec3): void;
|
||||
updateBoundingRadius(): void;
|
||||
updateMassProperties(): void;
|
||||
updateInertiaWorld(force: Vec3): void;
|
||||
updateSolveMassProperties(): void;
|
||||
getVelocityAtWorldPoint(worldPoint: Vec3, result: Vec3): Vec3;
|
||||
|
||||
}
|
||||
|
||||
export interface IRaycastVehicleOptions {
|
||||
|
||||
chassisBody?: Body;
|
||||
indexRightAxis?: number;
|
||||
indexLeftAxis?: number;
|
||||
indexUpAxis?: number;
|
||||
|
||||
}
|
||||
|
||||
export interface IWheelInfoOptions {
|
||||
|
||||
chassisConnectionPointLocal?: Vec3;
|
||||
@@ -664,7 +540,7 @@ declare module CANNON {
|
||||
deltaRotation?: number;
|
||||
rollInfluence?: number;
|
||||
maxSuspensionForce?: number;
|
||||
isFrontWheel?: boolean;
|
||||
isFronmtWheel?: boolean;
|
||||
clippedInvContactDotSuspension?: number;
|
||||
suspensionRelativeVelocity?: number;
|
||||
suspensionForce?: number;
|
||||
@@ -683,55 +559,46 @@ declare module CANNON {
|
||||
|
||||
export class WheelInfo {
|
||||
|
||||
axleLocal: Vec3;
|
||||
axleWorld: Vec3;
|
||||
brake: number;
|
||||
maxSuspensionTravbel: number;
|
||||
customSlidingRotationalSpeed: number;
|
||||
useCustomSlidingRotationalSpeed: boolean;
|
||||
sliding: boolean;
|
||||
chassisConnectionPointLocal: Vec3;
|
||||
chassisConnectionPointWorld: Vec3;
|
||||
clippedInvContactDotSuspension: number;
|
||||
customSlidingRotationalSpeed: number;
|
||||
dampingCompression: number;
|
||||
dampingRelaxation: number;
|
||||
deltaRotation: number;
|
||||
directionLocal: Vec3;
|
||||
directionWorld: Vec3;
|
||||
engineForce: number;
|
||||
forwardImpulse: number;
|
||||
frictionSlip: number;
|
||||
isFrontWheel: boolean;
|
||||
isInContact: boolean;
|
||||
maxSuspensionForce: number;
|
||||
maxSuspensionTravel: number;
|
||||
radius: number;
|
||||
raycastResult: RaycastResult;
|
||||
rollInfluence: number;
|
||||
rotation: number;
|
||||
sideImpulse: number;
|
||||
skidInfo: number;
|
||||
sliding: boolean;
|
||||
steering: number;
|
||||
suspensionForce: number;
|
||||
suspensionLength: number;
|
||||
suspensionMaxLength: number;
|
||||
suspensionRelativeVelocity: number;
|
||||
suspensionStiffness: number;
|
||||
axleLocal: Vec3;
|
||||
axleWorld: Vec3;
|
||||
suspensionRestLength: number;
|
||||
useCustomSlidingRotationalSpeed: boolean;
|
||||
suspensionMaxLength: number;
|
||||
radius: number;
|
||||
suspensionStiffness: number;
|
||||
dampingCompression: number;
|
||||
dampingRelaxation: number;
|
||||
frictionSlip: number;
|
||||
steering: number;
|
||||
rotation: number;
|
||||
deltaRotation: number;
|
||||
rollInfluence: number;
|
||||
maxSuspensionForce: number;
|
||||
engineForce: number;
|
||||
brake: number;
|
||||
isFrontWheel: boolean;
|
||||
clippedInvContactDotSuspension: number;
|
||||
suspensionRelativeVelocity: number;
|
||||
suspensionForce: number;
|
||||
skidInfo: number;
|
||||
suspensionLength: number;
|
||||
sideImpulse: number;
|
||||
forwardImpulse: number;
|
||||
raycastResult: RaycastResult;
|
||||
worldTransform: Transform;
|
||||
isInContact: boolean;
|
||||
|
||||
constructor(options?: IWheelInfoOptions);
|
||||
|
||||
}
|
||||
|
||||
export interface IRaycastVehicleOptions {
|
||||
|
||||
chassisBody?: Body;
|
||||
indexRightAxis?: number;
|
||||
indexLeftAxis?: number;
|
||||
indexUpAxis?: number;
|
||||
|
||||
}
|
||||
|
||||
export class RaycastVehicle {
|
||||
|
||||
chassisBody: Body;
|
||||
@@ -752,7 +619,6 @@ declare module CANNON {
|
||||
getVehicleAxisWorld(axisIndex: number, result: Vec3): Vec3;
|
||||
updateVehicle(timeStep: number): void;
|
||||
updateSuspension(deltaTime: number): void;
|
||||
updateWheelTransform(wheelIndex: number): void;
|
||||
removeFromWorld(world: World): void;
|
||||
getWheelTransformWorld(wheelIndex: number): Transform;
|
||||
|
||||
@@ -843,15 +709,20 @@ declare module CANNON {
|
||||
|
||||
export class Box extends Shape {
|
||||
|
||||
static calculateInertia(halfExtents: Vec3, mass: number, target: Vec3): void;
|
||||
static calculateIntertia(halfExtents: Vec3, mass: number, target: Vec3): void;
|
||||
|
||||
boundingSphereRadius: number;
|
||||
collisionResponse: boolean;
|
||||
halfExtents: Vec3;
|
||||
convexPolyhedronRepresentation: ConvexPolyhedron;
|
||||
|
||||
constructor(halfExtents: Vec3);
|
||||
|
||||
updateConvexPolyhedronRepresentation(): void;
|
||||
calculateLocalInertia(mass: number, target?: Vec3): Vec3;
|
||||
getSideNormals(sixTargetVectors: boolean, quat?: Quaternion): Vec3[];
|
||||
updateBoundingSphereRadius(): number;
|
||||
volume(): number;
|
||||
forEachWorldCorner(pos: Vec3, quat: Quaternion, callback: Function): void;
|
||||
|
||||
}
|
||||
@@ -860,7 +731,6 @@ declare module CANNON {
|
||||
|
||||
static computeNormal(va: Vec3, vb: Vec3, vc: Vec3, target: Vec3): void;
|
||||
static project(hull: ConvexPolyhedron, axis: Vec3, pos: Vec3, quat: Quaternion, result: number[]): void;
|
||||
static getFaceNormal(va: Vec3, vb: Vec3, vc: Vec3, target: Vec3): void;
|
||||
|
||||
vertices: Vec3[];
|
||||
worldVertices: Vec3[];
|
||||
@@ -868,7 +738,6 @@ declare module CANNON {
|
||||
faces: number[];
|
||||
faceNormals: Vec3[];
|
||||
uniqueEdges: Vec3[];
|
||||
uniqueAxes: Vec3[];
|
||||
|
||||
constructor(points?: Vec3[], faces?: number[]);
|
||||
|
||||
@@ -876,7 +745,7 @@ declare module CANNON {
|
||||
computeNormals(): void;
|
||||
getFaceNormal(i: number, target: Vec3): Vec3;
|
||||
clipAgainstHull(posA: Vec3, quatA: Quaternion, hullB: Vec3, quatB: Quaternion, separatingNormal: Vec3, minDist: number, maxDist: number, result: any[]): void;
|
||||
findSeparatingAxis(hullB: ConvexPolyhedron, posA: Vec3, quatA: Quaternion, posB: Vec3, quatB: Quaternion, target: Vec3, faceListA: any[], faceListB: any[]): boolean;
|
||||
findSaparatingAxis(hullB: ConvexPolyhedron, posA: Vec3, quatA: Quaternion, posB: Vec3, quatB: Quaternion, target: Vec3, faceListA: any[], faceListB: any[]): boolean;
|
||||
testSepAxis(axis: Vec3, hullB: ConvexPolyhedron, posA: Vec3, quatA: Quaternion, posB: Vec3, quatB: Quaternion): number;
|
||||
getPlaneConstantOfFace(face_i: number): number;
|
||||
clipFaceAgainstHull(separatingNormal: Vec3, posA: Vec3, quatA: Quaternion, worldVertsB1: Vec3[], minDist: number, maxDist: number, result: any[]): void;
|
||||
@@ -891,13 +760,13 @@ declare module CANNON {
|
||||
|
||||
}
|
||||
|
||||
export class Cylinder extends ConvexPolyhedron {
|
||||
export class Cylinder extends Shape {
|
||||
|
||||
constructor(radiusTop: number, radiusBottom: number, height: number, numSegments: number);
|
||||
|
||||
}
|
||||
|
||||
export interface IHightfieldOptions {
|
||||
export interface IHightfield {
|
||||
|
||||
minValue?: number;
|
||||
maxValue?: number;
|
||||
@@ -916,7 +785,7 @@ declare module CANNON {
|
||||
pillarOffset: Vec3;
|
||||
type: number;
|
||||
|
||||
constructor(data: number[], options?: IHightfieldOptions);
|
||||
constructor(data: number[], options?: IHightfield);
|
||||
|
||||
update(): void;
|
||||
updateMinValue(): void;
|
||||
@@ -958,14 +827,13 @@ declare module CANNON {
|
||||
|
||||
}
|
||||
|
||||
id: number;
|
||||
type: number;
|
||||
boundingSphereRadius: number;
|
||||
collisionResponse: boolean;
|
||||
|
||||
updateBoundingSphereRadius(): number;
|
||||
volume(): number;
|
||||
calculateLocalInertia(mass: number, target?: Vec3): Vec3;
|
||||
calculateLocalInertia(mass: number, target: Vec3): Vec3;
|
||||
|
||||
}
|
||||
|
||||
@@ -988,7 +856,7 @@ declare module CANNON {
|
||||
}
|
||||
|
||||
export class Solver {
|
||||
|
||||
iterations: number;
|
||||
equations: Equation[];
|
||||
|
||||
solve(dy: number, world: World): number;
|
||||
@@ -1048,7 +916,7 @@ declare module CANNON {
|
||||
|
||||
export class Vec3Pool extends Pool {
|
||||
|
||||
static defaults(options: Object, defaults: Object): Object;
|
||||
type: any;
|
||||
|
||||
constructObject(): Vec3;
|
||||
|
||||
@@ -1057,66 +925,8 @@ declare module CANNON {
|
||||
export class NarrowPhase {
|
||||
|
||||
contactPointPool: Pool[];
|
||||
enableFrictionReduction: boolean;
|
||||
v3pool: Vec3Pool;
|
||||
|
||||
convexHeightfield(convexShape: Shape, hfShape: Heightfield, convexPos: Vec3, hfPos: Vec3, convexQuat: Quaternion, hfQuat: Quaternion, convexBody: Body, hfBody: Body): void;
|
||||
convexConvex(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void;
|
||||
convexParticle(result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void;
|
||||
convexTrimesh( result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void;
|
||||
createContactEquation(bi: Body, bj: Body, si: Shape, sj: Shape, rsi: Shape, rsj: Shape): ContactEquation;
|
||||
getContacts(p1: Body[], p2: Body[], world: World, result: ContactEquation[], oldcontacts: ContactEquation[]): void;
|
||||
particlePlane( result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void;
|
||||
particleSphere(result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void;
|
||||
planeBox(result: ContactEquation[], si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void;
|
||||
planeConvex(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void;
|
||||
planeTrimesh(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void;
|
||||
sphereBox(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void;
|
||||
sphereConvex(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void;
|
||||
sphereHeightfield(sphereShape: Shape, hfShape: Heightfield, spherePos: Vec3, hfPos: Vec3, sphereQuat: Quaternion, hfQuat: Quaternion, sphereBody: Body, hfBody: Body): void;
|
||||
spherePlane( si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void;
|
||||
sphereSphere(si: Shape, sj: Shape, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion, bi: Body, bj: Body): void;
|
||||
sphereTrimesh(sphereShape: Shape, trimeshShape: Shape, spherePos: Vec3, trimeshPos: Vec3, sphereQuat: Quaternion, trimeshQuat: Quaternion, sphereBody: Body, trimeshBody: Body): void;
|
||||
|
||||
}
|
||||
|
||||
export interface IOctreeOptions {
|
||||
|
||||
root: Octree;
|
||||
aabb: AABB;
|
||||
|
||||
}
|
||||
|
||||
export class OctreeNode {
|
||||
|
||||
aabb: AABB;
|
||||
children: Octree[];
|
||||
data: number[];
|
||||
root: OctreeNode;
|
||||
|
||||
}
|
||||
|
||||
export class Octree extends OctreeNode {
|
||||
|
||||
maxDepth: number;
|
||||
|
||||
constructor(aabb: AABB, options: IOctreeOptions);
|
||||
|
||||
aabbQuery(aabb: AABB, result: Object[]): Object[];
|
||||
insert(aabb: AABB, elementData: Object): boolean;
|
||||
rayQuery(ray: Ray, treeTransform: Transform, result: Object[]): Object[];
|
||||
removeEmptyNodes(): void;
|
||||
subdivide(): void;
|
||||
|
||||
}
|
||||
|
||||
export interface IWorld {
|
||||
|
||||
collisisonFilterMask?: number;
|
||||
collisionFilterGroup?: number;
|
||||
skipBackfaces?: boolean;
|
||||
checkCollisionResponse?: boolean;
|
||||
|
||||
}
|
||||
|
||||
export class World extends EventTarget {
|
||||
@@ -1140,7 +950,7 @@ declare module CANNON {
|
||||
collisionMatrix: ArrayCollisionMatrix;
|
||||
collisionMatrixPrevious: ArrayCollisionMatrix;
|
||||
materials: Material[];
|
||||
contactMaterials: ContactMaterial[];
|
||||
contactmaterials: ContactMaterial[];
|
||||
contactMaterialTable: TupleDictionary;
|
||||
defaultMaterial: Material;
|
||||
defaultContactMaterial: ContactMaterial;
|
||||
@@ -1156,23 +966,16 @@ declare module CANNON {
|
||||
addBodyEvent: IBodyEvent;
|
||||
removeBodyEvent: IBodyEvent;
|
||||
|
||||
addBody(body: Body): void;
|
||||
addConstraint(c: Constraint): void;
|
||||
addContactMaterial(cmat: ContactMaterial): void;
|
||||
addEventListener(type: string, listener: Function): EventTarget;
|
||||
addMaterial(m: Material): void;
|
||||
clearForces(): void;
|
||||
collisionMatrixTick(): void;
|
||||
getContactMaterial(m1: Material, m2: Material): ContactMaterial;
|
||||
numObjects(): number;
|
||||
raycastAll(from: Vec3, to: Vec3, options: IWorld, callback: Function): boolean;
|
||||
raycastAny(from: Vec3, to: Vec3, options: IWorld, result: RaycastResult): boolean;
|
||||
raycastClosest(from: Vec3, to: Vec3, options: IWorld, result: RaycastResult): boolean;
|
||||
collisionMatrixTick(): void;
|
||||
addBody(body: Body): void;
|
||||
addConstraint(c: Constraint): void;
|
||||
removeConstraint(c: Constraint): void;
|
||||
rayTest(from: Vec3, to: Vec3, result: RaycastResult): void;
|
||||
remove(body: Body): void;
|
||||
removeBody(body: Body): void;
|
||||
removeConstraint(c: Constraint): void;
|
||||
removeEventListener(type: string, listener: Function): EventTarget;
|
||||
addMaterial(m: Material): void;
|
||||
addContactMaterial(cmat: ContactMaterial): void;
|
||||
step(dy: number, timeSinceLastCalled?: number, maxSubSteps?: number): void;
|
||||
|
||||
}
|
||||
@@ -1189,17 +992,9 @@ declare module CANNON {
|
||||
|
||||
}
|
||||
|
||||
export class Demo {
|
||||
|
||||
constructor( options: Object );
|
||||
|
||||
addScene( title: string, initfunc: Function ): void;
|
||||
restartCurrentScene(): void;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "cannon" {
|
||||
export = CANNON;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user