Compare commits
4 Commits
master
...
rename-act
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48d4cd44f4 | ||
|
|
71204d266f | ||
|
|
509c4f0cd7 | ||
|
|
f23158ae90 |
19447
dist/planck-with-testbed.cjs
vendored
19447
dist/planck-with-testbed.cjs
vendored
File diff suppressed because it is too large
Load Diff
1
dist/planck-with-testbed.cjs.map
vendored
1
dist/planck-with-testbed.cjs.map
vendored
File diff suppressed because one or more lines are too long
244
dist/planck-with-testbed.d.ts
vendored
244
dist/planck-with-testbed.d.ts
vendored
@ -17,12 +17,6 @@ interface Vec2Value {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
declare function Vec2(x: number, y: number): Vec2;
|
||||
declare function Vec2(obj: {
|
||||
x: number;
|
||||
y: number;
|
||||
}): Vec2;
|
||||
declare function Vec2(): Vec2;
|
||||
declare class Vec2 {
|
||||
x: number;
|
||||
y: number;
|
||||
@ -182,13 +176,6 @@ interface Vec3Value {
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
declare function Vec3(x: number, y: number, z: number): Vec3;
|
||||
declare function Vec3(obj: {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}): Vec3;
|
||||
declare function Vec3(): Vec3;
|
||||
declare class Vec3 {
|
||||
x: number;
|
||||
y: number;
|
||||
@ -324,7 +311,6 @@ interface RotValue {
|
||||
s: number;
|
||||
c: number;
|
||||
}
|
||||
declare function Rot(angle?: number | RotValue): Rot;
|
||||
declare class Rot {
|
||||
s: number;
|
||||
c: number;
|
||||
@ -368,12 +354,6 @@ type TransformValue = {
|
||||
p: Vec2Value;
|
||||
q: RotValue;
|
||||
};
|
||||
/**
|
||||
* A transform contains translation and rotation. It is used to represent the
|
||||
* position and orientation of rigid frames. Initialize using a position vector
|
||||
* and a rotation.
|
||||
*/
|
||||
declare function Transform(position?: Vec2Value, rotation?: number): Transform;
|
||||
/**
|
||||
* A transform contains translation and rotation. It is used to represent the
|
||||
* position and orientation of rigid frames. Initialize using a position vector
|
||||
@ -432,7 +412,6 @@ interface AABBValue {
|
||||
lowerBound: Vec2Value;
|
||||
upperBound: Vec2Value;
|
||||
}
|
||||
declare function AABB(lower?: Vec2Value, upper?: Vec2Value): AABB;
|
||||
declare class AABB {
|
||||
lowerBound: Vec2;
|
||||
upperBound: Vec2;
|
||||
@ -1233,7 +1212,6 @@ type WorldRayCastCallback = (fixture: Fixture, point: Vec2, normal: Vec2, fracti
|
||||
* Called for each fixture found in the query AABB. It may return `false` to terminate the query.
|
||||
*/
|
||||
type WorldAABBQueryCallback = (fixture: Fixture) => boolean;
|
||||
declare function World(def?: WorldDef | Vec2 | null): World;
|
||||
declare class World {
|
||||
/**
|
||||
* @param def World definition or gravity vector.
|
||||
@ -2158,8 +2136,6 @@ declare abstract class Shape {
|
||||
abstract computeDistanceProxy(proxy: DistanceProxy, childIndex: number): void;
|
||||
}
|
||||
type ShapeType = "circle" | "edge" | "polygon" | "chain";
|
||||
declare function CircleShape(position: Vec2Value, radius?: number): CircleShape;
|
||||
declare function CircleShape(radius?: number): CircleShape;
|
||||
declare class CircleShape extends Shape {
|
||||
static TYPE: "circle";
|
||||
m_type: "circle";
|
||||
@ -2211,12 +2187,6 @@ declare class CircleShape extends Shape {
|
||||
computeDistanceProxy(proxy: DistanceProxy): void;
|
||||
}
|
||||
declare const Circle: typeof CircleShape;
|
||||
/**
|
||||
* A line segment (edge) shape. These can be connected in chains or loops to
|
||||
* other edge shapes. The connectivity information is used to ensure correct
|
||||
* contact normals.
|
||||
*/
|
||||
declare function EdgeShape(v1?: Vec2Value, v2?: Vec2Value): EdgeShape;
|
||||
/**
|
||||
* A line segment (edge) shape. These can be connected in chains or loops to
|
||||
* other edge shapes. The connectivity information is used to ensure correct
|
||||
@ -2299,13 +2269,6 @@ declare class EdgeShape extends Shape {
|
||||
computeDistanceProxy(proxy: DistanceProxy): void;
|
||||
}
|
||||
declare const Edge: typeof EdgeShape;
|
||||
/**
|
||||
* A convex polygon. It is assumed that the interior of the polygon is to the
|
||||
* left of each edge. Polygons have a maximum number of vertices equal to
|
||||
* Settings.maxPolygonVertices. In most cases you should not need many vertices
|
||||
* for a convex polygon. extends Shape
|
||||
*/
|
||||
declare function PolygonShape(vertices?: Vec2Value[]): PolygonShape;
|
||||
/**
|
||||
* A convex polygon. It is assumed that the interior of the polygon is to the
|
||||
* left of each edge. Polygons have a maximum number of vertices equal to
|
||||
@ -2370,15 +2333,6 @@ declare class PolygonShape extends Shape {
|
||||
computeDistanceProxy(proxy: DistanceProxy): void;
|
||||
}
|
||||
declare const Polygon: typeof PolygonShape;
|
||||
/**
|
||||
* A chain shape is a free form sequence of line segments. The chain has
|
||||
* two-sided collision, so you can use inside and outside collision. Therefore,
|
||||
* you may use any winding order. Connectivity information is used to create
|
||||
* smooth collisions.
|
||||
*
|
||||
* WARNING: The chain will not collide properly if there are self-intersections.
|
||||
*/
|
||||
declare function ChainShape(vertices?: Vec2Value[], loop?: boolean): ChainShape;
|
||||
/**
|
||||
* A chain shape is a free form sequence of line segments. The chain has
|
||||
* two-sided collision, so you can use inside and outside collision. Therefore,
|
||||
@ -2466,10 +2420,6 @@ declare class ChainShape extends Shape {
|
||||
computeDistanceProxy(proxy: DistanceProxy, childIndex: number): void;
|
||||
}
|
||||
declare const Chain: typeof ChainShape;
|
||||
/**
|
||||
* A rectangle polygon which extend PolygonShape.
|
||||
*/
|
||||
declare function BoxShape(hx: number, hy: number, center?: Vec2Value, angle?: number): BoxShape;
|
||||
/**
|
||||
* A rectangle polygon which extend PolygonShape.
|
||||
*/
|
||||
@ -2537,22 +2487,6 @@ interface DistanceJointDef extends JointDef, DistanceJointOpt {
|
||||
*/
|
||||
localAnchorB: Vec2;
|
||||
}
|
||||
/**
|
||||
* A distance joint constrains two points on two bodies to remain at a fixed
|
||||
* distance from each other. You can view this as a massless, rigid rod.
|
||||
*
|
||||
* @param anchorA Anchor A in global coordination.
|
||||
* @param anchorB Anchor B in global coordination.
|
||||
*/
|
||||
declare function DistanceJoint(def: DistanceJointDef): DistanceJoint;
|
||||
/**
|
||||
* A distance joint constrains two points on two bodies to remain at a fixed
|
||||
* distance from each other. You can view this as a massless, rigid rod.
|
||||
*
|
||||
* @param anchorA Anchor A in global coordination.
|
||||
* @param anchorB Anchor B in global coordination.
|
||||
*/
|
||||
declare function DistanceJoint(def: DistanceJointOpt, bodyA: Body, bodyB: Body, anchorA: Vec2, anchorB: Vec2): DistanceJoint;
|
||||
/**
|
||||
* A distance joint constrains two points on two bodies to remain at a fixed
|
||||
* distance from each other. You can view this as a massless, rigid rod.
|
||||
@ -2634,20 +2568,6 @@ interface FrictionJointDef extends JointDef, FrictionJointOpt {
|
||||
*/
|
||||
localAnchorB: Vec2;
|
||||
}
|
||||
/**
|
||||
* Friction joint. This is used for top-down friction. It provides 2D
|
||||
* translational friction and angular friction.
|
||||
*
|
||||
* @param anchor Anchor in global coordination.
|
||||
*/
|
||||
declare function FrictionJoint(def: FrictionJointDef): FrictionJoint;
|
||||
/**
|
||||
* Friction joint. This is used for top-down friction. It provides 2D
|
||||
* translational friction and angular friction.
|
||||
*
|
||||
* @param anchor Anchor in global coordination.
|
||||
*/
|
||||
declare function FrictionJoint(def: FrictionJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2): FrictionJoint;
|
||||
/**
|
||||
* Friction joint. This is used for top-down friction. It provides 2D
|
||||
* translational friction and angular friction.
|
||||
@ -2770,24 +2690,6 @@ interface RevoluteJointDef extends JointDef, RevoluteJointOpt {
|
||||
*/
|
||||
referenceAngle: number;
|
||||
}
|
||||
/**
|
||||
* A revolute joint constrains two bodies to share a common point while they are
|
||||
* free to rotate about the point. The relative rotation about the shared point
|
||||
* is the joint angle. You can limit the relative rotation with a joint limit
|
||||
* that specifies a lower and upper angle. You can use a motor to drive the
|
||||
* relative rotation about the shared point. A maximum motor torque is provided
|
||||
* so that infinite forces are not generated.
|
||||
*/
|
||||
declare function RevoluteJoint(def: RevoluteJointDef): RevoluteJoint;
|
||||
/**
|
||||
* A revolute joint constrains two bodies to share a common point while they are
|
||||
* free to rotate about the point. The relative rotation about the shared point
|
||||
* is the joint angle. You can limit the relative rotation with a joint limit
|
||||
* that specifies a lower and upper angle. You can use a motor to drive the
|
||||
* relative rotation about the shared point. A maximum motor torque is provided
|
||||
* so that infinite forces are not generated.
|
||||
*/
|
||||
declare function RevoluteJoint(def: RevoluteJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2): RevoluteJoint;
|
||||
/**
|
||||
* A revolute joint constrains two bodies to share a common point while they are
|
||||
* free to rotate about the point. The relative rotation about the shared point
|
||||
@ -2951,20 +2853,6 @@ interface PrismaticJointDef extends JointDef, PrismaticJointOpt {
|
||||
*/
|
||||
referenceAngle: number;
|
||||
}
|
||||
/**
|
||||
* A prismatic joint. This joint provides one degree of freedom: translation
|
||||
* along an axis fixed in bodyA. Relative rotation is prevented. You can use a
|
||||
* joint limit to restrict the range of motion and a joint motor to drive the
|
||||
* motion or to model joint friction.
|
||||
*/
|
||||
declare function PrismaticJoint(def: PrismaticJointDef): PrismaticJoint;
|
||||
/**
|
||||
* A prismatic joint. This joint provides one degree of freedom: translation
|
||||
* along an axis fixed in bodyA. Relative rotation is prevented. You can use a
|
||||
* joint limit to restrict the range of motion and a joint motor to drive the
|
||||
* motion or to model joint friction.
|
||||
*/
|
||||
declare function PrismaticJoint(def: PrismaticJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2, axis: Vec2): PrismaticJoint;
|
||||
/**
|
||||
* A prismatic joint. This joint provides one degree of freedom: translation
|
||||
* along an axis fixed in bodyA. Relative rotation is prevented. You can use a
|
||||
@ -3089,34 +2977,6 @@ interface GearJointDef extends JointDef, GearJointOpt {
|
||||
*/
|
||||
joint2: RevoluteJoint | PrismaticJoint;
|
||||
}
|
||||
/**
|
||||
* A gear joint is used to connect two joints together. Either joint can be a
|
||||
* revolute or prismatic joint. You specify a gear ratio to bind the motions
|
||||
* together: coordinate1 + ratio * coordinate2 = constant
|
||||
*
|
||||
* The ratio can be negative or positive. If one joint is a revolute joint and
|
||||
* the other joint is a prismatic joint, then the ratio will have units of
|
||||
* length or units of 1/length. Warning: You have to manually destroy the gear
|
||||
* joint if joint1 or joint2 is destroyed.
|
||||
*
|
||||
* This definition requires two existing revolute or prismatic joints (any
|
||||
* combination will work).
|
||||
*/
|
||||
declare function GearJoint(def: GearJointDef): GearJoint;
|
||||
/**
|
||||
* A gear joint is used to connect two joints together. Either joint can be a
|
||||
* revolute or prismatic joint. You specify a gear ratio to bind the motions
|
||||
* together: coordinate1 + ratio * coordinate2 = constant
|
||||
*
|
||||
* The ratio can be negative or positive. If one joint is a revolute joint and
|
||||
* the other joint is a prismatic joint, then the ratio will have units of
|
||||
* length or units of 1/length. Warning: You have to manually destroy the gear
|
||||
* joint if joint1 or joint2 is destroyed.
|
||||
*
|
||||
* This definition requires two existing revolute or prismatic joints (any
|
||||
* combination will work).
|
||||
*/
|
||||
declare function GearJoint(def: GearJointOpt, bodyA: Body, bodyB: Body, joint1: RevoluteJoint | PrismaticJoint, joint2: RevoluteJoint | PrismaticJoint, ratio?: number): GearJoint;
|
||||
/**
|
||||
* A gear joint is used to connect two joints together. Either joint can be a
|
||||
* revolute or prismatic joint. You specify a gear ratio to bind the motions
|
||||
@ -3203,18 +3063,6 @@ interface MotorJointOpt extends JointOpt {
|
||||
*/
|
||||
interface MotorJointDef extends JointDef, MotorJointOpt {
|
||||
}
|
||||
/**
|
||||
* A motor joint is used to control the relative motion between two bodies. A
|
||||
* typical usage is to control the movement of a dynamic body with respect to
|
||||
* the ground.
|
||||
*/
|
||||
declare function MotorJoint(def: MotorJointDef): MotorJoint;
|
||||
/**
|
||||
* A motor joint is used to control the relative motion between two bodies. A
|
||||
* typical usage is to control the movement of a dynamic body with respect to
|
||||
* the ground.
|
||||
*/
|
||||
declare function MotorJoint(def: MotorJointOpt, bodyA: Body, bodyB: Body): MotorJoint;
|
||||
/**
|
||||
* A motor joint is used to control the relative motion between two bodies. A
|
||||
* typical usage is to control the movement of a dynamic body with respect to
|
||||
@ -3313,26 +3161,6 @@ interface MouseJointDef extends JointDef, MouseJointOpt {
|
||||
*/
|
||||
target: Vec2Value;
|
||||
}
|
||||
/**
|
||||
* A mouse joint is used to make a point on a body track a specified world
|
||||
* point. This a soft constraint with a maximum force. This allows the
|
||||
* constraint to stretch and without applying huge forces.
|
||||
*
|
||||
* NOTE: this joint is not documented in the manual because it was developed to
|
||||
* be used in the testbed. If you want to learn how to use the mouse joint, look
|
||||
* at the testbed.
|
||||
*/
|
||||
declare function MouseJoint(def: MouseJointDef): MouseJoint;
|
||||
/**
|
||||
* A mouse joint is used to make a point on a body track a specified world
|
||||
* point. This a soft constraint with a maximum force. This allows the
|
||||
* constraint to stretch and without applying huge forces.
|
||||
*
|
||||
* NOTE: this joint is not documented in the manual because it was developed to
|
||||
* be used in the testbed. If you want to learn how to use the mouse joint, look
|
||||
* at the testbed.
|
||||
*/
|
||||
declare function MouseJoint(def: MouseJointOpt, bodyA: Body, bodyB: Body, target: Vec2): MouseJoint;
|
||||
/**
|
||||
* A mouse joint is used to make a point on a body track a specified world
|
||||
* point. This a soft constraint with a maximum force. This allows the
|
||||
@ -3443,30 +3271,6 @@ interface PulleyJointDef extends JointDef, PulleyJointOpt {
|
||||
*/
|
||||
ratio: number;
|
||||
}
|
||||
/**
|
||||
* The pulley joint is connected to two bodies and two fixed ground points. The
|
||||
* pulley supports a ratio such that: length1 + ratio * length2 <= constant
|
||||
*
|
||||
* Yes, the force transmitted is scaled by the ratio.
|
||||
*
|
||||
* Warning: the pulley joint can get a bit squirrelly by itself. They often work
|
||||
* better when combined with prismatic joints. You should also cover the the
|
||||
* anchor points with static shapes to prevent one side from going to zero
|
||||
* length.
|
||||
*/
|
||||
declare function PulleyJoint(def: PulleyJointDef): PulleyJoint;
|
||||
/**
|
||||
* The pulley joint is connected to two bodies and two fixed ground points. The
|
||||
* pulley supports a ratio such that: length1 + ratio * length2 <= constant
|
||||
*
|
||||
* Yes, the force transmitted is scaled by the ratio.
|
||||
*
|
||||
* Warning: the pulley joint can get a bit squirrelly by itself. They often work
|
||||
* better when combined with prismatic joints. You should also cover the the
|
||||
* anchor points with static shapes to prevent one side from going to zero
|
||||
* length.
|
||||
*/
|
||||
declare function PulleyJoint(def: PulleyJointOpt, bodyA: Body, bodyB: Body, groundA: Vec2, groundB: Vec2, anchorA: Vec2, anchorB: Vec2, ratio: number): PulleyJoint;
|
||||
/**
|
||||
* The pulley joint is connected to two bodies and two fixed ground points. The
|
||||
* pulley supports a ratio such that: length1 + ratio * length2 <= constant
|
||||
@ -3567,30 +3371,6 @@ interface RopeJointDef extends JointDef, RopeJointOpt {
|
||||
*/
|
||||
localAnchorB: Vec2;
|
||||
}
|
||||
/**
|
||||
* A rope joint enforces a maximum distance between two points on two bodies. It
|
||||
* has no other effect.
|
||||
*
|
||||
* Warning: if you attempt to change the maximum length during the simulation
|
||||
* you will get some non-physical behavior.
|
||||
*
|
||||
* A model that would allow you to dynamically modify the length would have some
|
||||
* sponginess, so I chose not to implement it that way. See {@link DistanceJoint} if you
|
||||
* want to dynamically control length.
|
||||
*/
|
||||
declare function RopeJoint(def: RopeJointDef): RopeJoint;
|
||||
/**
|
||||
* A rope joint enforces a maximum distance between two points on two bodies. It
|
||||
* has no other effect.
|
||||
*
|
||||
* Warning: if you attempt to change the maximum length during the simulation
|
||||
* you will get some non-physical behavior.
|
||||
*
|
||||
* A model that would allow you to dynamically modify the length would have some
|
||||
* sponginess, so I chose not to implement it that way. See {@link DistanceJoint} if you
|
||||
* want to dynamically control length.
|
||||
*/
|
||||
declare function RopeJoint(def: RopeJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2): RopeJoint;
|
||||
/**
|
||||
* A rope joint enforces a maximum distance between two points on two bodies. It
|
||||
* has no other effect.
|
||||
@ -3688,16 +3468,6 @@ interface WeldJointDef extends JointDef, WeldJointOpt {
|
||||
*/
|
||||
localAnchorB: Vec2;
|
||||
}
|
||||
/**
|
||||
* A weld joint essentially glues two bodies together. A weld joint may distort
|
||||
* somewhat because the island constraint solver is approximate.
|
||||
*/
|
||||
declare function WeldJoint(def: WeldJointDef): WeldJoint;
|
||||
/**
|
||||
* A weld joint essentially glues two bodies together. A weld joint may distort
|
||||
* somewhat because the island constraint solver is approximate.
|
||||
*/
|
||||
declare function WeldJoint(def: WeldJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2): WeldJoint;
|
||||
/**
|
||||
* A weld joint essentially glues two bodies together. A weld joint may distort
|
||||
* somewhat because the island constraint solver is approximate.
|
||||
@ -3809,20 +3579,6 @@ interface WheelJointDef extends JointDef, WheelJointOpt {
|
||||
*/
|
||||
localAxisA: Vec2;
|
||||
}
|
||||
/**
|
||||
* A wheel joint. This joint provides two degrees of freedom: translation along
|
||||
* an axis fixed in bodyA and rotation in the plane. In other words, it is a
|
||||
* point to line constraint with a rotational motor and a linear spring/damper.
|
||||
* This joint is designed for vehicle suspensions.
|
||||
*/
|
||||
declare function WheelJoint(def: WheelJointDef): WheelJoint;
|
||||
/**
|
||||
* A wheel joint. This joint provides two degrees of freedom: translation along
|
||||
* an axis fixed in bodyA and rotation in the plane. In other words, it is a
|
||||
* point to line constraint with a rotational motor and a linear spring/damper.
|
||||
* This joint is designed for vehicle suspensions.
|
||||
*/
|
||||
declare function WheelJoint(def: WheelJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2, axis: Vec2): WheelJoint;
|
||||
/**
|
||||
* A wheel joint. This joint provides two degrees of freedom: translation along
|
||||
* an axis fixed in bodyA and rotation in the plane. In other words, it is a
|
||||
|
||||
2
dist/planck-with-testbed.d.ts.map
vendored
2
dist/planck-with-testbed.d.ts.map
vendored
File diff suppressed because one or more lines are too long
9550
dist/planck-with-testbed.js
vendored
9550
dist/planck-with-testbed.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/planck-with-testbed.js.map
vendored
2
dist/planck-with-testbed.js.map
vendored
File diff suppressed because one or more lines are too long
18
dist/planck-with-testbed.min.js
vendored
18
dist/planck-with-testbed.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/planck-with-testbed.min.js.map
vendored
2
dist/planck-with-testbed.min.js.map
vendored
File diff suppressed because one or more lines are too long
15978
dist/planck.cjs
vendored
15978
dist/planck.cjs
vendored
File diff suppressed because it is too large
Load Diff
1
dist/planck.cjs.map
vendored
1
dist/planck.cjs.map
vendored
File diff suppressed because one or more lines are too long
244
dist/planck.d.ts
vendored
244
dist/planck.d.ts
vendored
@ -17,12 +17,6 @@ interface Vec2Value {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
declare function Vec2(x: number, y: number): Vec2;
|
||||
declare function Vec2(obj: {
|
||||
x: number;
|
||||
y: number;
|
||||
}): Vec2;
|
||||
declare function Vec2(): Vec2;
|
||||
declare class Vec2 {
|
||||
x: number;
|
||||
y: number;
|
||||
@ -182,13 +176,6 @@ interface Vec3Value {
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
declare function Vec3(x: number, y: number, z: number): Vec3;
|
||||
declare function Vec3(obj: {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}): Vec3;
|
||||
declare function Vec3(): Vec3;
|
||||
declare class Vec3 {
|
||||
x: number;
|
||||
y: number;
|
||||
@ -324,7 +311,6 @@ interface RotValue {
|
||||
s: number;
|
||||
c: number;
|
||||
}
|
||||
declare function Rot(angle?: number | RotValue): Rot;
|
||||
declare class Rot {
|
||||
s: number;
|
||||
c: number;
|
||||
@ -368,12 +354,6 @@ type TransformValue = {
|
||||
p: Vec2Value;
|
||||
q: RotValue;
|
||||
};
|
||||
/**
|
||||
* A transform contains translation and rotation. It is used to represent the
|
||||
* position and orientation of rigid frames. Initialize using a position vector
|
||||
* and a rotation.
|
||||
*/
|
||||
declare function Transform(position?: Vec2Value, rotation?: number): Transform;
|
||||
/**
|
||||
* A transform contains translation and rotation. It is used to represent the
|
||||
* position and orientation of rigid frames. Initialize using a position vector
|
||||
@ -432,7 +412,6 @@ interface AABBValue {
|
||||
lowerBound: Vec2Value;
|
||||
upperBound: Vec2Value;
|
||||
}
|
||||
declare function AABB(lower?: Vec2Value, upper?: Vec2Value): AABB;
|
||||
declare class AABB {
|
||||
lowerBound: Vec2;
|
||||
upperBound: Vec2;
|
||||
@ -1233,7 +1212,6 @@ type WorldRayCastCallback = (fixture: Fixture, point: Vec2, normal: Vec2, fracti
|
||||
* Called for each fixture found in the query AABB. It may return `false` to terminate the query.
|
||||
*/
|
||||
type WorldAABBQueryCallback = (fixture: Fixture) => boolean;
|
||||
declare function World(def?: WorldDef | Vec2 | null): World;
|
||||
declare class World {
|
||||
/**
|
||||
* @param def World definition or gravity vector.
|
||||
@ -2158,8 +2136,6 @@ declare abstract class Shape {
|
||||
abstract computeDistanceProxy(proxy: DistanceProxy, childIndex: number): void;
|
||||
}
|
||||
type ShapeType = "circle" | "edge" | "polygon" | "chain";
|
||||
declare function CircleShape(position: Vec2Value, radius?: number): CircleShape;
|
||||
declare function CircleShape(radius?: number): CircleShape;
|
||||
declare class CircleShape extends Shape {
|
||||
static TYPE: "circle";
|
||||
m_type: "circle";
|
||||
@ -2211,12 +2187,6 @@ declare class CircleShape extends Shape {
|
||||
computeDistanceProxy(proxy: DistanceProxy): void;
|
||||
}
|
||||
declare const Circle: typeof CircleShape;
|
||||
/**
|
||||
* A line segment (edge) shape. These can be connected in chains or loops to
|
||||
* other edge shapes. The connectivity information is used to ensure correct
|
||||
* contact normals.
|
||||
*/
|
||||
declare function EdgeShape(v1?: Vec2Value, v2?: Vec2Value): EdgeShape;
|
||||
/**
|
||||
* A line segment (edge) shape. These can be connected in chains or loops to
|
||||
* other edge shapes. The connectivity information is used to ensure correct
|
||||
@ -2299,13 +2269,6 @@ declare class EdgeShape extends Shape {
|
||||
computeDistanceProxy(proxy: DistanceProxy): void;
|
||||
}
|
||||
declare const Edge: typeof EdgeShape;
|
||||
/**
|
||||
* A convex polygon. It is assumed that the interior of the polygon is to the
|
||||
* left of each edge. Polygons have a maximum number of vertices equal to
|
||||
* Settings.maxPolygonVertices. In most cases you should not need many vertices
|
||||
* for a convex polygon. extends Shape
|
||||
*/
|
||||
declare function PolygonShape(vertices?: Vec2Value[]): PolygonShape;
|
||||
/**
|
||||
* A convex polygon. It is assumed that the interior of the polygon is to the
|
||||
* left of each edge. Polygons have a maximum number of vertices equal to
|
||||
@ -2370,15 +2333,6 @@ declare class PolygonShape extends Shape {
|
||||
computeDistanceProxy(proxy: DistanceProxy): void;
|
||||
}
|
||||
declare const Polygon: typeof PolygonShape;
|
||||
/**
|
||||
* A chain shape is a free form sequence of line segments. The chain has
|
||||
* two-sided collision, so you can use inside and outside collision. Therefore,
|
||||
* you may use any winding order. Connectivity information is used to create
|
||||
* smooth collisions.
|
||||
*
|
||||
* WARNING: The chain will not collide properly if there are self-intersections.
|
||||
*/
|
||||
declare function ChainShape(vertices?: Vec2Value[], loop?: boolean): ChainShape;
|
||||
/**
|
||||
* A chain shape is a free form sequence of line segments. The chain has
|
||||
* two-sided collision, so you can use inside and outside collision. Therefore,
|
||||
@ -2466,10 +2420,6 @@ declare class ChainShape extends Shape {
|
||||
computeDistanceProxy(proxy: DistanceProxy, childIndex: number): void;
|
||||
}
|
||||
declare const Chain: typeof ChainShape;
|
||||
/**
|
||||
* A rectangle polygon which extend PolygonShape.
|
||||
*/
|
||||
declare function BoxShape(hx: number, hy: number, center?: Vec2Value, angle?: number): BoxShape;
|
||||
/**
|
||||
* A rectangle polygon which extend PolygonShape.
|
||||
*/
|
||||
@ -2537,22 +2487,6 @@ interface DistanceJointDef extends JointDef, DistanceJointOpt {
|
||||
*/
|
||||
localAnchorB: Vec2;
|
||||
}
|
||||
/**
|
||||
* A distance joint constrains two points on two bodies to remain at a fixed
|
||||
* distance from each other. You can view this as a massless, rigid rod.
|
||||
*
|
||||
* @param anchorA Anchor A in global coordination.
|
||||
* @param anchorB Anchor B in global coordination.
|
||||
*/
|
||||
declare function DistanceJoint(def: DistanceJointDef): DistanceJoint;
|
||||
/**
|
||||
* A distance joint constrains two points on two bodies to remain at a fixed
|
||||
* distance from each other. You can view this as a massless, rigid rod.
|
||||
*
|
||||
* @param anchorA Anchor A in global coordination.
|
||||
* @param anchorB Anchor B in global coordination.
|
||||
*/
|
||||
declare function DistanceJoint(def: DistanceJointOpt, bodyA: Body, bodyB: Body, anchorA: Vec2, anchorB: Vec2): DistanceJoint;
|
||||
/**
|
||||
* A distance joint constrains two points on two bodies to remain at a fixed
|
||||
* distance from each other. You can view this as a massless, rigid rod.
|
||||
@ -2634,20 +2568,6 @@ interface FrictionJointDef extends JointDef, FrictionJointOpt {
|
||||
*/
|
||||
localAnchorB: Vec2;
|
||||
}
|
||||
/**
|
||||
* Friction joint. This is used for top-down friction. It provides 2D
|
||||
* translational friction and angular friction.
|
||||
*
|
||||
* @param anchor Anchor in global coordination.
|
||||
*/
|
||||
declare function FrictionJoint(def: FrictionJointDef): FrictionJoint;
|
||||
/**
|
||||
* Friction joint. This is used for top-down friction. It provides 2D
|
||||
* translational friction and angular friction.
|
||||
*
|
||||
* @param anchor Anchor in global coordination.
|
||||
*/
|
||||
declare function FrictionJoint(def: FrictionJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2): FrictionJoint;
|
||||
/**
|
||||
* Friction joint. This is used for top-down friction. It provides 2D
|
||||
* translational friction and angular friction.
|
||||
@ -2770,24 +2690,6 @@ interface RevoluteJointDef extends JointDef, RevoluteJointOpt {
|
||||
*/
|
||||
referenceAngle: number;
|
||||
}
|
||||
/**
|
||||
* A revolute joint constrains two bodies to share a common point while they are
|
||||
* free to rotate about the point. The relative rotation about the shared point
|
||||
* is the joint angle. You can limit the relative rotation with a joint limit
|
||||
* that specifies a lower and upper angle. You can use a motor to drive the
|
||||
* relative rotation about the shared point. A maximum motor torque is provided
|
||||
* so that infinite forces are not generated.
|
||||
*/
|
||||
declare function RevoluteJoint(def: RevoluteJointDef): RevoluteJoint;
|
||||
/**
|
||||
* A revolute joint constrains two bodies to share a common point while they are
|
||||
* free to rotate about the point. The relative rotation about the shared point
|
||||
* is the joint angle. You can limit the relative rotation with a joint limit
|
||||
* that specifies a lower and upper angle. You can use a motor to drive the
|
||||
* relative rotation about the shared point. A maximum motor torque is provided
|
||||
* so that infinite forces are not generated.
|
||||
*/
|
||||
declare function RevoluteJoint(def: RevoluteJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2): RevoluteJoint;
|
||||
/**
|
||||
* A revolute joint constrains two bodies to share a common point while they are
|
||||
* free to rotate about the point. The relative rotation about the shared point
|
||||
@ -2951,20 +2853,6 @@ interface PrismaticJointDef extends JointDef, PrismaticJointOpt {
|
||||
*/
|
||||
referenceAngle: number;
|
||||
}
|
||||
/**
|
||||
* A prismatic joint. This joint provides one degree of freedom: translation
|
||||
* along an axis fixed in bodyA. Relative rotation is prevented. You can use a
|
||||
* joint limit to restrict the range of motion and a joint motor to drive the
|
||||
* motion or to model joint friction.
|
||||
*/
|
||||
declare function PrismaticJoint(def: PrismaticJointDef): PrismaticJoint;
|
||||
/**
|
||||
* A prismatic joint. This joint provides one degree of freedom: translation
|
||||
* along an axis fixed in bodyA. Relative rotation is prevented. You can use a
|
||||
* joint limit to restrict the range of motion and a joint motor to drive the
|
||||
* motion or to model joint friction.
|
||||
*/
|
||||
declare function PrismaticJoint(def: PrismaticJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2, axis: Vec2): PrismaticJoint;
|
||||
/**
|
||||
* A prismatic joint. This joint provides one degree of freedom: translation
|
||||
* along an axis fixed in bodyA. Relative rotation is prevented. You can use a
|
||||
@ -3089,34 +2977,6 @@ interface GearJointDef extends JointDef, GearJointOpt {
|
||||
*/
|
||||
joint2: RevoluteJoint | PrismaticJoint;
|
||||
}
|
||||
/**
|
||||
* A gear joint is used to connect two joints together. Either joint can be a
|
||||
* revolute or prismatic joint. You specify a gear ratio to bind the motions
|
||||
* together: coordinate1 + ratio * coordinate2 = constant
|
||||
*
|
||||
* The ratio can be negative or positive. If one joint is a revolute joint and
|
||||
* the other joint is a prismatic joint, then the ratio will have units of
|
||||
* length or units of 1/length. Warning: You have to manually destroy the gear
|
||||
* joint if joint1 or joint2 is destroyed.
|
||||
*
|
||||
* This definition requires two existing revolute or prismatic joints (any
|
||||
* combination will work).
|
||||
*/
|
||||
declare function GearJoint(def: GearJointDef): GearJoint;
|
||||
/**
|
||||
* A gear joint is used to connect two joints together. Either joint can be a
|
||||
* revolute or prismatic joint. You specify a gear ratio to bind the motions
|
||||
* together: coordinate1 + ratio * coordinate2 = constant
|
||||
*
|
||||
* The ratio can be negative or positive. If one joint is a revolute joint and
|
||||
* the other joint is a prismatic joint, then the ratio will have units of
|
||||
* length or units of 1/length. Warning: You have to manually destroy the gear
|
||||
* joint if joint1 or joint2 is destroyed.
|
||||
*
|
||||
* This definition requires two existing revolute or prismatic joints (any
|
||||
* combination will work).
|
||||
*/
|
||||
declare function GearJoint(def: GearJointOpt, bodyA: Body, bodyB: Body, joint1: RevoluteJoint | PrismaticJoint, joint2: RevoluteJoint | PrismaticJoint, ratio?: number): GearJoint;
|
||||
/**
|
||||
* A gear joint is used to connect two joints together. Either joint can be a
|
||||
* revolute or prismatic joint. You specify a gear ratio to bind the motions
|
||||
@ -3203,18 +3063,6 @@ interface MotorJointOpt extends JointOpt {
|
||||
*/
|
||||
interface MotorJointDef extends JointDef, MotorJointOpt {
|
||||
}
|
||||
/**
|
||||
* A motor joint is used to control the relative motion between two bodies. A
|
||||
* typical usage is to control the movement of a dynamic body with respect to
|
||||
* the ground.
|
||||
*/
|
||||
declare function MotorJoint(def: MotorJointDef): MotorJoint;
|
||||
/**
|
||||
* A motor joint is used to control the relative motion between two bodies. A
|
||||
* typical usage is to control the movement of a dynamic body with respect to
|
||||
* the ground.
|
||||
*/
|
||||
declare function MotorJoint(def: MotorJointOpt, bodyA: Body, bodyB: Body): MotorJoint;
|
||||
/**
|
||||
* A motor joint is used to control the relative motion between two bodies. A
|
||||
* typical usage is to control the movement of a dynamic body with respect to
|
||||
@ -3313,26 +3161,6 @@ interface MouseJointDef extends JointDef, MouseJointOpt {
|
||||
*/
|
||||
target: Vec2Value;
|
||||
}
|
||||
/**
|
||||
* A mouse joint is used to make a point on a body track a specified world
|
||||
* point. This a soft constraint with a maximum force. This allows the
|
||||
* constraint to stretch and without applying huge forces.
|
||||
*
|
||||
* NOTE: this joint is not documented in the manual because it was developed to
|
||||
* be used in the testbed. If you want to learn how to use the mouse joint, look
|
||||
* at the testbed.
|
||||
*/
|
||||
declare function MouseJoint(def: MouseJointDef): MouseJoint;
|
||||
/**
|
||||
* A mouse joint is used to make a point on a body track a specified world
|
||||
* point. This a soft constraint with a maximum force. This allows the
|
||||
* constraint to stretch and without applying huge forces.
|
||||
*
|
||||
* NOTE: this joint is not documented in the manual because it was developed to
|
||||
* be used in the testbed. If you want to learn how to use the mouse joint, look
|
||||
* at the testbed.
|
||||
*/
|
||||
declare function MouseJoint(def: MouseJointOpt, bodyA: Body, bodyB: Body, target: Vec2): MouseJoint;
|
||||
/**
|
||||
* A mouse joint is used to make a point on a body track a specified world
|
||||
* point. This a soft constraint with a maximum force. This allows the
|
||||
@ -3443,30 +3271,6 @@ interface PulleyJointDef extends JointDef, PulleyJointOpt {
|
||||
*/
|
||||
ratio: number;
|
||||
}
|
||||
/**
|
||||
* The pulley joint is connected to two bodies and two fixed ground points. The
|
||||
* pulley supports a ratio such that: length1 + ratio * length2 <= constant
|
||||
*
|
||||
* Yes, the force transmitted is scaled by the ratio.
|
||||
*
|
||||
* Warning: the pulley joint can get a bit squirrelly by itself. They often work
|
||||
* better when combined with prismatic joints. You should also cover the the
|
||||
* anchor points with static shapes to prevent one side from going to zero
|
||||
* length.
|
||||
*/
|
||||
declare function PulleyJoint(def: PulleyJointDef): PulleyJoint;
|
||||
/**
|
||||
* The pulley joint is connected to two bodies and two fixed ground points. The
|
||||
* pulley supports a ratio such that: length1 + ratio * length2 <= constant
|
||||
*
|
||||
* Yes, the force transmitted is scaled by the ratio.
|
||||
*
|
||||
* Warning: the pulley joint can get a bit squirrelly by itself. They often work
|
||||
* better when combined with prismatic joints. You should also cover the the
|
||||
* anchor points with static shapes to prevent one side from going to zero
|
||||
* length.
|
||||
*/
|
||||
declare function PulleyJoint(def: PulleyJointOpt, bodyA: Body, bodyB: Body, groundA: Vec2, groundB: Vec2, anchorA: Vec2, anchorB: Vec2, ratio: number): PulleyJoint;
|
||||
/**
|
||||
* The pulley joint is connected to two bodies and two fixed ground points. The
|
||||
* pulley supports a ratio such that: length1 + ratio * length2 <= constant
|
||||
@ -3567,30 +3371,6 @@ interface RopeJointDef extends JointDef, RopeJointOpt {
|
||||
*/
|
||||
localAnchorB: Vec2;
|
||||
}
|
||||
/**
|
||||
* A rope joint enforces a maximum distance between two points on two bodies. It
|
||||
* has no other effect.
|
||||
*
|
||||
* Warning: if you attempt to change the maximum length during the simulation
|
||||
* you will get some non-physical behavior.
|
||||
*
|
||||
* A model that would allow you to dynamically modify the length would have some
|
||||
* sponginess, so I chose not to implement it that way. See {@link DistanceJoint} if you
|
||||
* want to dynamically control length.
|
||||
*/
|
||||
declare function RopeJoint(def: RopeJointDef): RopeJoint;
|
||||
/**
|
||||
* A rope joint enforces a maximum distance between two points on two bodies. It
|
||||
* has no other effect.
|
||||
*
|
||||
* Warning: if you attempt to change the maximum length during the simulation
|
||||
* you will get some non-physical behavior.
|
||||
*
|
||||
* A model that would allow you to dynamically modify the length would have some
|
||||
* sponginess, so I chose not to implement it that way. See {@link DistanceJoint} if you
|
||||
* want to dynamically control length.
|
||||
*/
|
||||
declare function RopeJoint(def: RopeJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2): RopeJoint;
|
||||
/**
|
||||
* A rope joint enforces a maximum distance between two points on two bodies. It
|
||||
* has no other effect.
|
||||
@ -3688,16 +3468,6 @@ interface WeldJointDef extends JointDef, WeldJointOpt {
|
||||
*/
|
||||
localAnchorB: Vec2;
|
||||
}
|
||||
/**
|
||||
* A weld joint essentially glues two bodies together. A weld joint may distort
|
||||
* somewhat because the island constraint solver is approximate.
|
||||
*/
|
||||
declare function WeldJoint(def: WeldJointDef): WeldJoint;
|
||||
/**
|
||||
* A weld joint essentially glues two bodies together. A weld joint may distort
|
||||
* somewhat because the island constraint solver is approximate.
|
||||
*/
|
||||
declare function WeldJoint(def: WeldJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2): WeldJoint;
|
||||
/**
|
||||
* A weld joint essentially glues two bodies together. A weld joint may distort
|
||||
* somewhat because the island constraint solver is approximate.
|
||||
@ -3809,20 +3579,6 @@ interface WheelJointDef extends JointDef, WheelJointOpt {
|
||||
*/
|
||||
localAxisA: Vec2;
|
||||
}
|
||||
/**
|
||||
* A wheel joint. This joint provides two degrees of freedom: translation along
|
||||
* an axis fixed in bodyA and rotation in the plane. In other words, it is a
|
||||
* point to line constraint with a rotational motor and a linear spring/damper.
|
||||
* This joint is designed for vehicle suspensions.
|
||||
*/
|
||||
declare function WheelJoint(def: WheelJointDef): WheelJoint;
|
||||
/**
|
||||
* A wheel joint. This joint provides two degrees of freedom: translation along
|
||||
* an axis fixed in bodyA and rotation in the plane. In other words, it is a
|
||||
* point to line constraint with a rotational motor and a linear spring/damper.
|
||||
* This joint is designed for vehicle suspensions.
|
||||
*/
|
||||
declare function WheelJoint(def: WheelJointOpt, bodyA: Body, bodyB: Body, anchor: Vec2, axis: Vec2): WheelJoint;
|
||||
/**
|
||||
* A wheel joint. This joint provides two degrees of freedom: translation along
|
||||
* an axis fixed in bodyA and rotation in the plane. In other words, it is a
|
||||
|
||||
2
dist/planck.d.ts.map
vendored
2
dist/planck.d.ts.map
vendored
File diff suppressed because one or more lines are too long
9068
dist/planck.js
vendored
9068
dist/planck.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/planck.js.map
vendored
2
dist/planck.js.map
vendored
File diff suppressed because one or more lines are too long
18
dist/planck.min.js
vendored
18
dist/planck.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/planck.min.js.map
vendored
2
dist/planck.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -124,7 +124,7 @@ testbed.keydown = function(code, char) {
|
||||
case 'Z':
|
||||
for (var i = 0; i < bodies.length; i += 2) {
|
||||
var body = bodies[i];
|
||||
body.setActive(!body.isActive());
|
||||
body.setEnabled(!body.isEnabled());
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "planck",
|
||||
"version": "1.0.0-beta.8",
|
||||
"version": "2.0-dev.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "planck",
|
||||
"version": "1.0.0-beta.7",
|
||||
"version": "2.0-dev.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"stage-js": "github:piqnt/stage.js#v1-alpha"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "planck",
|
||||
"version": "1.0.0-beta.8",
|
||||
"version": "2.0-dev.0",
|
||||
"description": "2D JavaScript/TypeScript physics engine for cross-platform HTML5 game development",
|
||||
"homepage": "https://github.com/shakiba/planck.js",
|
||||
"keywords": [
|
||||
@ -35,13 +35,11 @@
|
||||
".": {
|
||||
"types": "./dist/planck.d.ts",
|
||||
"umd": "./dist/planck.min.js",
|
||||
"require": "./dist/planck.cjs",
|
||||
"default": "./dist/planck.js"
|
||||
},
|
||||
"./with-testbed": {
|
||||
"types": "./dist/planck-with-testbed.d.ts",
|
||||
"umd": "./dist/planck-with-testbed.min.js",
|
||||
"require": "./dist/planck-with-testbed.cjs",
|
||||
"default": "./dist/planck-with-testbed.js"
|
||||
},
|
||||
"./dist/*": "./dist/*"
|
||||
|
||||
@ -18,14 +18,14 @@ module.exports = [
|
||||
sourcemap: false,
|
||||
declaration: true,
|
||||
},
|
||||
{
|
||||
format: 'cjs',
|
||||
src: 'src/main.ts',
|
||||
dest: 'dist/planck.cjs',
|
||||
minimize: false,
|
||||
sourcemap: false,
|
||||
declaration: false,
|
||||
},
|
||||
// {
|
||||
// format: 'cjs',
|
||||
// src: 'src/main.ts',
|
||||
// dest: 'dist/planck.cjs',
|
||||
// minimize: false,
|
||||
// sourcemap: false,
|
||||
// declaration: false,
|
||||
// },
|
||||
{
|
||||
format: 'umd',
|
||||
src: 'src/main.ts',
|
||||
@ -42,14 +42,14 @@ module.exports = [
|
||||
sourcemap: false,
|
||||
declaration: true,
|
||||
},
|
||||
{
|
||||
format: 'cjs',
|
||||
src: 'testbed/main.ts',
|
||||
dest: 'dist/planck-with-testbed.cjs',
|
||||
minimize: false,
|
||||
sourcemap: false,
|
||||
declaration: false,
|
||||
},
|
||||
// {
|
||||
// format: 'cjs',
|
||||
// src: 'testbed/main.ts',
|
||||
// dest: 'dist/planck-with-testbed.cjs',
|
||||
// minimize: false,
|
||||
// sourcemap: false,
|
||||
// declaration: false,
|
||||
// },
|
||||
{
|
||||
format: 'umd',
|
||||
src: 'testbed/main.ts',
|
||||
@ -74,8 +74,8 @@ module.exports = [
|
||||
'ASSERT': JSON.stringify(false),
|
||||
'_ASSERT': JSON.stringify(false),
|
||||
// we are still compiling to ES5, so we keep constructor factories until v2
|
||||
'CONSTRUCTOR_FACTORY': JSON.stringify(true),
|
||||
'_CONSTRUCTOR_FACTORY': JSON.stringify(true),
|
||||
'CONSTRUCTOR_FACTORY': JSON.stringify(false),
|
||||
'_CONSTRUCTOR_FACTORY': JSON.stringify(false),
|
||||
},
|
||||
}),
|
||||
nodeResolve(),
|
||||
@ -86,36 +86,36 @@ module.exports = [
|
||||
declaration: options.declaration,
|
||||
declarationMap: options.declaration
|
||||
}),
|
||||
transformers: {
|
||||
afterDeclarations: [
|
||||
declarationTransformer({
|
||||
classes: [
|
||||
'Vec2',
|
||||
'Vec3',
|
||||
'Rot',
|
||||
'Transform',
|
||||
'AABB',
|
||||
'World',
|
||||
'BoxShape',
|
||||
'CircleShape',
|
||||
'ChainShape',
|
||||
'EdgeShape',
|
||||
'PolygonShape',
|
||||
'DistanceJoint',
|
||||
'FrictionJoint',
|
||||
'GearJoint',
|
||||
'MotorJoint',
|
||||
'MouseJoint',
|
||||
'PrismaticJoint',
|
||||
'PulleyJoint',
|
||||
'RevoluteJoint',
|
||||
'RopeJoint',
|
||||
'WeldJoint',
|
||||
'WheelJoint',
|
||||
]
|
||||
})
|
||||
]
|
||||
},
|
||||
// transformers: {
|
||||
// afterDeclarations: [
|
||||
// declarationTransformer({
|
||||
// classes: [
|
||||
// 'Vec2',
|
||||
// 'Vec3',
|
||||
// 'Rot',
|
||||
// 'Transform',
|
||||
// 'AABB',
|
||||
// 'World',
|
||||
// 'BoxShape',
|
||||
// 'CircleShape',
|
||||
// 'ChainShape',
|
||||
// 'EdgeShape',
|
||||
// 'PolygonShape',
|
||||
// 'DistanceJoint',
|
||||
// 'FrictionJoint',
|
||||
// 'GearJoint',
|
||||
// 'MotorJoint',
|
||||
// 'MouseJoint',
|
||||
// 'PrismaticJoint',
|
||||
// 'PulleyJoint',
|
||||
// 'RevoluteJoint',
|
||||
// 'RopeJoint',
|
||||
// 'WeldJoint',
|
||||
// 'WheelJoint',
|
||||
// ]
|
||||
// })
|
||||
// ]
|
||||
// },
|
||||
}),
|
||||
license({
|
||||
banner: licenseBanner,
|
||||
|
||||
@ -137,7 +137,7 @@ export class Settings {
|
||||
* to 1 often lead to overshoot.
|
||||
*/
|
||||
static baumgarte: number = 0.2;
|
||||
static toiBaugarte: number = 0.75;
|
||||
static toiBaumgarte: number = 0.75;
|
||||
|
||||
// Sleep
|
||||
|
||||
@ -219,8 +219,8 @@ export class SettingsInternal {
|
||||
static get baumgarte() {
|
||||
return Settings.baumgarte;
|
||||
}
|
||||
static get toiBaugarte() {
|
||||
return Settings.toiBaugarte;
|
||||
static get toiBaumgarte() {
|
||||
return Settings.toiBaumgarte;
|
||||
}
|
||||
static get timeToSleep() {
|
||||
return Settings.timeToSleep;
|
||||
|
||||
@ -84,15 +84,15 @@ export class Sweep {
|
||||
/**
|
||||
* Get the interpolated transform at a specific time.
|
||||
*
|
||||
* @param xf
|
||||
* @param transform the output transform
|
||||
* @param beta A factor in [0,1], where 0 indicates alpha0
|
||||
*/
|
||||
getTransform(xf: TransformValue, beta: number = 0): void {
|
||||
matrix.setRotAngle(xf.q, (1.0 - beta) * this.a0 + beta * this.a);
|
||||
matrix.combineVec2(xf.p, (1.0 - beta), this.c0, beta, this.c);
|
||||
getTransform(transform: TransformValue, beta: number = 0): void {
|
||||
matrix.setRotAngle(transform.q, (1.0 - beta) * this.a0 + beta * this.a);
|
||||
matrix.combineVec2(transform.p, (1.0 - beta), this.c0, beta, this.c);
|
||||
|
||||
// shift to origin
|
||||
matrix.subVec2(xf.p, matrix.rotVec2(temp, xf.q, this.localCenter));
|
||||
matrix.subVec2(transform.p, matrix.rotVec2(temp, transform.q, this.localCenter));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -108,9 +108,9 @@ export interface BodyDef {
|
||||
*/
|
||||
awake?: boolean;
|
||||
/**
|
||||
* Does this body start out active?
|
||||
* Does this body start out enabled?
|
||||
*/
|
||||
active?: boolean;
|
||||
enabled?: boolean;
|
||||
userData?: any;
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ const BodyDefDefault: BodyDef = {
|
||||
|
||||
allowSleep : true,
|
||||
awake : true,
|
||||
active : true,
|
||||
enabled : true,
|
||||
|
||||
userData : null
|
||||
};
|
||||
@ -185,7 +185,7 @@ export class Body {
|
||||
/** @internal */ m_autoSleepFlag: boolean;
|
||||
/** @internal */ m_bulletFlag: boolean;
|
||||
/** @internal */ m_fixedRotationFlag: boolean;
|
||||
/** @internal */ m_activeFlag: boolean;
|
||||
/** @internal */ m_enabledFlag: boolean;
|
||||
/** @internal */ m_islandFlag: boolean;
|
||||
/** @internal */ m_toiFlag: boolean;
|
||||
/** @internal */ m_userData: unknown;
|
||||
@ -234,7 +234,7 @@ export class Body {
|
||||
this.m_autoSleepFlag = def.allowSleep;
|
||||
this.m_bulletFlag = def.bullet;
|
||||
this.m_fixedRotationFlag = def.fixedRotation;
|
||||
this.m_activeFlag = def.active;
|
||||
this.m_enabledFlag = def.enabled;
|
||||
|
||||
this.m_islandFlag = false;
|
||||
this.m_toiFlag = false;
|
||||
@ -486,39 +486,42 @@ export class Body {
|
||||
}
|
||||
}
|
||||
|
||||
isActive(): boolean {
|
||||
return this.m_activeFlag;
|
||||
isEnabled(): boolean {
|
||||
return this.m_enabledFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the active state of the body. An inactive body is not simulated and
|
||||
* cannot be collided with or woken up. If you pass a flag of true, all fixtures
|
||||
* will be added to the broad-phase. If you pass a flag of false, all fixtures
|
||||
* will be removed from the broad-phase and all contacts will be destroyed.
|
||||
* Fixtures and joints are otherwise unaffected.
|
||||
*
|
||||
* You may continue to create/destroy fixtures and joints on inactive bodies.
|
||||
* Fixtures on an inactive body are implicitly inactive and will not participate
|
||||
* in collisions, ray-casts, or queries. Joints connected to an inactive body
|
||||
* are implicitly inactive. An inactive body is still owned by a World object
|
||||
* and remains
|
||||
* Allow a body to be disabled. A disabled body is not simulated and cannot be
|
||||
* collided with or woken up.
|
||||
* If you pass a flag of true, all fixtures will be added to the broad-phase.
|
||||
* If you pass a flag of false, all fixtures will be removed from the
|
||||
* broad-phase and all contacts will be destroyed.
|
||||
*
|
||||
* Fixtures and joints are otherwise unaffected. You may continue to
|
||||
* create/destroy fixtures and joints on disabled bodies.
|
||||
* Fixtures on a disabled body are implicitly disabled and will not
|
||||
* participate in collisions, ray-casts, or queries.
|
||||
* Joints connected to a disabled body are implicitly disabled.
|
||||
* An diabled body is still owned by a b2World object and remains in the body
|
||||
* list.
|
||||
*/
|
||||
setActive(flag: boolean): void {
|
||||
setEnabled(flag: boolean): void {
|
||||
_ASSERT && console.assert(this.isWorldLocked() == false);
|
||||
|
||||
if (flag == this.m_activeFlag) {
|
||||
if (flag == this.m_enabledFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.m_activeFlag = !!flag;
|
||||
this.m_enabledFlag = !!flag;
|
||||
|
||||
if (this.m_activeFlag) {
|
||||
if (this.m_enabledFlag) {
|
||||
// Create all proxies.
|
||||
const broadPhase = this.m_world.m_broadPhase;
|
||||
for (let f = this.m_fixtureList; f; f = f.m_next) {
|
||||
f.createProxies(broadPhase, this.m_xf);
|
||||
}
|
||||
// Contacts are created the next time step.
|
||||
// Contacts are created at the beginning of the next time step.
|
||||
this.m_world.m_newContacts = true;
|
||||
|
||||
} else {
|
||||
// Destroy all proxies.
|
||||
@ -1021,7 +1024,7 @@ export class Body {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (this.m_activeFlag) {
|
||||
if (this.m_enabledFlag) {
|
||||
const broadPhase = this.m_world.m_broadPhase;
|
||||
fixture.createProxies(broadPhase, this.m_xf);
|
||||
}
|
||||
@ -1036,7 +1039,7 @@ export class Body {
|
||||
|
||||
// Let the world know we have a new fixture. This will cause new contacts
|
||||
// to be created at the beginning of the next time step.
|
||||
this.m_world.m_newFixture = true;
|
||||
this.m_world.m_newContacts = true;
|
||||
|
||||
return fixture;
|
||||
}
|
||||
@ -1124,7 +1127,7 @@ export class Body {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.m_activeFlag) {
|
||||
if (this.m_enabledFlag) {
|
||||
const broadPhase = this.m_world.m_broadPhase;
|
||||
fixture.destroyProxies(broadPhase);
|
||||
}
|
||||
|
||||
@ -732,7 +732,7 @@ export class Contact {
|
||||
// Track max constraint error.
|
||||
minSeparation = Math.min(minSeparation, separation);
|
||||
|
||||
const baumgarte = toi ? Settings.toiBaugarte : Settings.baumgarte;
|
||||
const baumgarte = toi ? Settings.toiBaumgarte : Settings.baumgarte;
|
||||
const linearSlop = Settings.linearSlop;
|
||||
const maxLinearCorrection = Settings.maxLinearCorrection;
|
||||
|
||||
|
||||
@ -126,10 +126,10 @@ export abstract class Joint {
|
||||
}
|
||||
|
||||
/**
|
||||
* Short-cut function to determine if either body is inactive.
|
||||
* Short-cut function to determine if either body is enabled.
|
||||
*/
|
||||
isActive(): boolean {
|
||||
return this.m_bodyA.isActive() && this.m_bodyB.isActive();
|
||||
isEnabled(): boolean {
|
||||
return this.m_bodyA.isEnabled() && this.m_bodyB.isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -185,7 +185,7 @@ export class Solver {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (seed.isAwake() == false || seed.isActive() == false) {
|
||||
if (seed.isAwake() == false || seed.isEnabled() == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ export class Solver {
|
||||
while (stack.length > 0) {
|
||||
// Grab the next body off the stack and add it to the island.
|
||||
const b = stack.pop();
|
||||
_ASSERT && console.assert(b.isActive() == true);
|
||||
_ASSERT && console.assert(b.isEnabled() == true);
|
||||
this.addBody(b);
|
||||
|
||||
// Make sure the body is awake (without resetting sleep timer).
|
||||
@ -262,7 +262,7 @@ export class Solver {
|
||||
const other = je.other;
|
||||
|
||||
// Don't simulate joints connected to inactive bodies.
|
||||
if (other.isActive() == false) {
|
||||
if (other.isEnabled() == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -74,14 +74,16 @@ const WorldDefDefault: WorldDef = {
|
||||
* Callback function for ray casts, see {@link World.rayCast}.
|
||||
*
|
||||
* Called for each fixture found in the query. You control how the ray cast
|
||||
* proceeds by returning a float: return -1: ignore this fixture and continue
|
||||
* return 0: terminate the ray cast return fraction: clip the ray to this point
|
||||
* proceeds by returning a float:
|
||||
* return -1: ignore this fixture and continue
|
||||
* return 0: terminate the ray cast
|
||||
* return fraction: clip the ray to this point
|
||||
* return 1: don't clip the ray and continue
|
||||
*
|
||||
* @param fixture The fixture hit by the ray
|
||||
* @param point The point of initial intersection
|
||||
* @param normal The normal vector at the point of intersection
|
||||
* @param fraction
|
||||
* @param fraction The fraction along the ray at the point of intersection
|
||||
*
|
||||
* @return -1 to filter, 0 to terminate, fraction to clip the ray for closest hit, 1 to continue
|
||||
*/
|
||||
@ -105,7 +107,7 @@ export class World {
|
||||
/** @internal */ m_allowSleep: boolean;
|
||||
/** @internal */ m_gravity: Vec2;
|
||||
/** @internal */ m_clearForces: boolean;
|
||||
/** @internal */ m_newFixture: boolean;
|
||||
/** @internal */ m_newContacts: boolean;
|
||||
/** @internal */ m_locked: boolean;
|
||||
/** @internal */ m_warmStarting: boolean;
|
||||
/** @internal */ m_continuousPhysics: boolean;
|
||||
@ -156,7 +158,7 @@ export class World {
|
||||
this.m_gravity = Vec2.clone(def.gravity);
|
||||
|
||||
this.m_clearForces = true;
|
||||
this.m_newFixture = false;
|
||||
this.m_newContacts = false;
|
||||
this.m_locked = false;
|
||||
|
||||
// These are for debugging the solver.
|
||||
@ -792,9 +794,9 @@ export class World {
|
||||
positionIterations = positionIterations || this.m_positionIterations;
|
||||
|
||||
// If new fixtures were added, we need to find the new contacts.
|
||||
if (this.m_newFixture) {
|
||||
if (this.m_newContacts) {
|
||||
this.findNewContacts();
|
||||
this.m_newFixture = false;
|
||||
this.m_newContacts = false;
|
||||
}
|
||||
|
||||
this.m_locked = true;
|
||||
|
||||
@ -349,6 +349,8 @@ export class DistanceJoint extends Joint {
|
||||
|
||||
// magic formulas
|
||||
const h = step.dt;
|
||||
|
||||
// gamma = 1 / (h * (d + h * k)), the extra factor of h in the denominator is since the lambda is an impulse, not a force
|
||||
this.m_gamma = h * (d + h * k);
|
||||
this.m_gamma = this.m_gamma != 0.0 ? 1.0 / this.m_gamma : 0.0;
|
||||
this.m_bias = C * h * k * this.m_gamma;
|
||||
|
||||
@ -7,12 +7,12 @@
|
||||
}
|
||||
},
|
||||
"compilerOptions": {
|
||||
"module": "ES2015",
|
||||
"module": "ES6",
|
||||
// "strictNullChecks": true,
|
||||
// "noImplicitAny": true,
|
||||
"lib": ["ES2015", "DOM"],
|
||||
"stripInternal": true,
|
||||
"target": "ES5",
|
||||
"target": "ES6",
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "Node",
|
||||
"resolveJsonModule": true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user