@box2d/debug-draw
Version:
Debug drawing helper for @box2d
158 lines • 6.68 kB
TypeScript
import { b2Draw } from "../common/b2_draw";
import { b2Vec2, b2Mat22, XY } from "../common/b2_math";
import { b2Readonly } from "../common/b2_readonly";
import { b2Body } from "./b2_body";
import { b2Joint, b2JointDef, b2IJointDef } from "./b2_joint";
import { b2SolverData } from "./b2_time_step";
export interface b2IPrismaticJointDef extends b2IJointDef {
localAnchorA?: XY;
localAnchorB?: XY;
localAxisA?: XY;
referenceAngle?: number;
enableLimit?: boolean;
lowerTranslation?: number;
upperTranslation?: number;
enableMotor?: boolean;
maxMotorForce?: number;
motorSpeed?: number;
}
/**
* Prismatic joint definition. This requires defining a line of
* motion using an axis and an anchor point. The definition uses local
* anchor points and a local axis so that the initial configuration
* can violate the constraint slightly. The joint translation is zero
* when the local anchor points coincide in world space. Using local
* anchors and a local axis helps when saving and loading a game.
*/
export declare class b2PrismaticJointDef extends b2JointDef implements b2IPrismaticJointDef {
/** The local anchor point relative to bodyA's origin. */
readonly localAnchorA: b2Vec2;
/** The local anchor point relative to bodyB's origin. */
readonly localAnchorB: b2Vec2;
/** The local translation unit axis in bodyA. */
readonly localAxisA: b2Vec2;
/** The constrained angle between the bodies: bodyB_angle - bodyA_angle. */
referenceAngle: number;
/** Enable/disable the joint limit. */
enableLimit: boolean;
/** The lower translation limit, usually in meters. */
lowerTranslation: number;
/** The upper translation limit, usually in meters. */
upperTranslation: number;
/** Enable/disable the joint motor. */
enableMotor: boolean;
/** The maximum motor torque, usually in N-m. */
maxMotorForce: number;
/** The desired motor speed in radians per second. */
motorSpeed: number;
constructor();
/**
* Initialize the bodies, anchors, axis, and reference angle using the world
* anchor and unit world axis.
*/
Initialize(bA: b2Body, bB: b2Body, anchor: XY, axis: XY): void;
}
/**
* 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.
*/
export declare class b2PrismaticJoint extends b2Joint {
/** @internal protected */
readonly m_localAnchorA: b2Vec2;
/** @internal protected */
readonly m_localAnchorB: b2Vec2;
/** @internal protected */
readonly m_localXAxisA: b2Vec2;
protected readonly m_localYAxisA: b2Vec2;
/** @internal protected */
m_referenceAngle: number;
protected readonly m_impulse: b2Vec2;
protected m_motorImpulse: number;
protected m_lowerImpulse: number;
protected m_upperImpulse: number;
protected m_lowerTranslation: number;
protected m_upperTranslation: number;
protected m_maxMotorForce: number;
protected m_motorSpeed: number;
protected m_enableLimit: boolean;
protected m_enableMotor: boolean;
protected m_indexA: number;
protected m_indexB: number;
protected readonly m_localCenterA: b2Vec2;
protected readonly m_localCenterB: b2Vec2;
protected m_invMassA: number;
protected m_invMassB: number;
protected m_invIA: number;
protected m_invIB: number;
protected readonly m_axis: b2Vec2;
protected readonly m_perp: b2Vec2;
protected m_s1: number;
protected m_s2: number;
protected m_a1: number;
protected m_a2: number;
protected readonly m_K: b2Mat22;
protected m_translation: number;
protected m_axialMass: number;
/** @internal protected */
constructor(def: b2IPrismaticJointDef);
/** @internal protected */
InitVelocityConstraints(data: b2SolverData): void;
/** @internal protected */
SolveVelocityConstraints(data: b2SolverData): void;
/**
* A velocity based solver computes reaction forces(impulses) using the velocity constraint solver.Under this context,
* the position solver is not there to resolve forces.It is only there to cope with integration error.
*
* Therefore, the pseudo impulses in the position solver do not have any physical meaning.Thus it is okay if they suck.
*
* We could take the active state from the velocity solver.However, the joint might push past the limit when the velocity
* solver indicates the limit is inactive.
*
* @internal protected
*/
SolvePositionConstraints(data: b2SolverData): boolean;
GetAnchorA<T extends XY>(out: T): T;
GetAnchorB<T extends XY>(out: T): T;
GetReactionForce<T extends XY>(inv_dt: number, out: T): T;
GetReactionTorque(inv_dt: number): number;
/** The local anchor point relative to bodyA's origin. */
GetLocalAnchorA(): b2Readonly<b2Vec2>;
/** The local anchor point relative to bodyB's origin. */
GetLocalAnchorB(): b2Readonly<b2Vec2>;
/** The local joint axis relative to bodyA. */
GetLocalAxisA(): b2Readonly<b2Vec2>;
/** Get the reference angle. */
GetReferenceAngle(): number;
/** Get the current joint translation, usually in meters. */
GetJointTranslation(): number;
/** Get the current joint translation speed, usually in meters per second. */
GetJointSpeed(): number;
/** Is the joint limit enabled? */
IsLimitEnabled(): boolean;
/** Enable/disable the joint limit. */
EnableLimit(flag: boolean): boolean;
/** Get the lower joint limit, usually in meters. */
GetLowerLimit(): number;
/** Get the upper joint limit, usually in meters. */
GetUpperLimit(): number;
/** Set the joint limits, usually in meters. */
SetLimits(lower: number, upper: number): void;
/** Is the joint motor enabled? */
IsMotorEnabled(): boolean;
/** Enable/disable the joint motor. */
EnableMotor(flag: boolean): boolean;
/** Set the motor speed, usually in meters per second. */
SetMotorSpeed(speed: number): number;
/** Get the motor speed, usually in meters per second. */
GetMotorSpeed(): number;
/** Set the maximum motor force, usually in N. */
SetMaxMotorForce(force: number): void;
/** Get the maximum motor force, usually in N. */
GetMaxMotorForce(): number;
/** Get the current motor force given the inverse time step, usually in N. */
GetMotorForce(inv_dt: number): number;
Draw(draw: b2Draw): void;
}
//# sourceMappingURL=b2_prismatic_joint.d.ts.map