Skip to content

Commit

Permalink
Merged Body.scale & Body.updateScale() pmndrs#110 by @krispya
Browse files Browse the repository at this point in the history
  • Loading branch information
upisfree committed Nov 8, 2022
1 parent 8b14771 commit 199c2b3
Show file tree
Hide file tree
Showing 67 changed files with 5,198 additions and 4,788 deletions.
192 changes: 145 additions & 47 deletions dist/cannon-es.cjs.js

Large diffs are not rendered by default.

23 changes: 21 additions & 2 deletions dist/cannon-es.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ declare module "shapes/Shape" {
volume(): number;
calculateLocalInertia(mass: number, target: Vec3): void;
calculateWorldAABB(pos: Vec3, quat: Quaternion, min: Vec3, max: Vec3): void;
updateScale(scale: Vec3): void;
}
}
declare module "collision/RaycastResult" {
Expand Down Expand Up @@ -215,11 +216,13 @@ declare module "shapes/Sphere" {
import type { Quaternion } from "math/Quaternion";
export class Sphere extends Shape {
radius: number;
initRadius: number;
constructor(radius: number);
calculateLocalInertia(mass: number, target?: Vec3): Vec3;
volume(): number;
updateBoundingSphereRadius(): void;
calculateWorldAABB(pos: Vec3, quat: Quaternion, min: Vec3, max: Vec3): void;
updateScale(scale: Vec3): void;
}
}
declare module "shapes/ConvexPolyhedron" {
Expand All @@ -233,6 +236,7 @@ declare module "shapes/ConvexPolyhedron" {
};
export class ConvexPolyhedron extends Shape {
vertices: Vec3[];
initVertices: Vec3[];
faces: number[][];
faceNormals: Vec3[];
worldVertices: Vec3[];
Expand All @@ -243,6 +247,7 @@ declare module "shapes/ConvexPolyhedron" {
uniqueEdges: Vec3[];
constructor(props?: {
vertices?: Vec3[];
initVertices?: Vec3[];
faces?: number[][];
normals?: Vec3[];
axes?: Vec3[];
Expand All @@ -269,6 +274,7 @@ declare module "shapes/ConvexPolyhedron" {
transformAllPoints(offset: Vec3, quat: Quaternion): void;
pointIsInside(p: Vec3): 1 | -1 | false;
static project(shape: ConvexPolyhedron, axis: Vec3, pos: Vec3, quat: Quaternion, result: number[]): void;
updateScale(scale: Vec3): void;
}
}
declare module "shapes/Box" {
Expand All @@ -278,8 +284,10 @@ declare module "shapes/Box" {
import type { Quaternion } from "math/Quaternion";
export class Box extends Shape {
halfExtents: Vec3;
initHalfExtents: Vec3;
convexPolyhedronRepresentation: ConvexPolyhedron;
constructor(halfExtents: Vec3);
updateScale(scale: Vec3): void;
updateConvexPolyhedronRepresentation(): void;
calculateLocalInertia(mass: number, target?: Vec3): Vec3;
static calculateInertia(halfExtents: Vec3, mass: number, target: Vec3): void;
Expand All @@ -304,6 +312,7 @@ declare module "shapes/Plane" {
volume(): number;
calculateWorldAABB(pos: Vec3, quat: Quaternion, min: Vec3, max: Vec3): void;
updateBoundingSphereRadius(): void;
updateScale(scale: Vec3): void;
}
}
declare module "utils/Utils" {
Expand All @@ -324,17 +333,22 @@ declare module "shapes/Heightfield" {
};
export class Heightfield extends Shape {
data: number[][];
initData: number[][];
maxValue: number | null;
minValue: number | null;
elementSize: number;
elementSizeX: number;
initElementSizeX: number;
elementSizeY: number;
initElementSizeY: number;
cacheEnabled: boolean;
pillarConvex: ConvexPolyhedron;
pillarOffset: Vec3;
private _cachedPillars;
constructor(data: number[][], options?: {
maxValue?: number | null;
minValue?: number | null;
elementSize?: number;
elementSizeX?: number;
elementSizeY?: number;
});
update(): void;
updateMinValue(): void;
Expand All @@ -357,6 +371,7 @@ declare module "shapes/Heightfield" {
calculateWorldAABB(pos: Vec3, quat: Quaternion, min: Vec3, max: Vec3): void;
updateBoundingSphereRadius(): void;
setHeightsFromImage(image: HTMLImageElement, scale: Vec3): void;
updateScale(scale: Vec3): void;
}
}
declare module "utils/Octree" {
Expand Down Expand Up @@ -572,6 +587,7 @@ declare module "shapes/Particle" {
volume(): number;
updateBoundingSphereRadius(): void;
calculateWorldAABB(pos: Vec3, quat: Quaternion, min: Vec3, max: Vec3): void;
updateScale(scale: Vec3): void;
}
}
declare module "shapes/Cylinder" {
Expand Down Expand Up @@ -1063,6 +1079,7 @@ declare module "objects/Body" {
boundingRadius: number;
wlambda: Vec3;
isTrigger: boolean;
scale: Vec3;
constructor(options?: {
collisionFilterGroup?: number;
collisionFilterMask?: number;
Expand All @@ -1084,6 +1101,7 @@ declare module "objects/Body" {
angularFactor?: Vec3;
shape?: Shape;
isTrigger?: boolean;
scale?: Vec3;
});
wakeUp(): void;
sleep(): void;
Expand All @@ -1095,6 +1113,7 @@ declare module "objects/Body" {
vectorToWorldFrame(localVector: Vec3, result?: Vec3): Vec3;
addShape(shape: Shape, _offset?: Vec3, _orientation?: Quaternion): Body;
removeShape(shape: Shape): Body;
updateScale(scale: Vec3): void;
updateBoundingRadius(): void;
updateAABB(): void;
updateInertiaWorld(force?: boolean): void;
Expand Down
Loading

0 comments on commit 199c2b3

Please sign in to comment.