UNPKG

@box2d/debug-draw

Version:

Debug drawing helper for @box2d

88 lines 3.27 kB
import { b2Draw } from "../common/b2_draw"; import { b2Vec2, b2Mat22, XY } from "../common/b2_math"; import { b2Joint, b2JointDef, b2IJointDef } from "./b2_joint"; import { b2SolverData } from "./b2_time_step"; export interface b2IMouseJointDef extends b2IJointDef { target?: XY; maxForce?: number; stiffness?: number; damping?: number; } /** * Mouse joint definition. This requires a world target point, * tuning parameters, and the time step. */ export declare class b2MouseJointDef extends b2JointDef implements b2IMouseJointDef { /** * The initial world target point. This is assumed * to coincide with the body anchor initially. */ readonly target: b2Vec2; /** * The maximum constraint force that can be exerted * to move the candidate body. Usually you will express * as some multiple of the weight (multiplier * mass * gravity). */ maxForce: number; /** The linear stiffness in N/m */ stiffness: number; /** The linear damping in N*s/m */ damping: number; constructor(); } /** * 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. */ export declare class b2MouseJoint extends b2Joint { protected readonly m_localAnchorB: b2Vec2; protected readonly m_targetA: b2Vec2; protected m_stiffness: number; protected m_damping: number; protected m_beta: number; protected readonly m_impulse: b2Vec2; protected m_maxForce: number; protected m_gamma: number; protected m_indexB: number; protected readonly m_rB: b2Vec2; protected readonly m_localCenterB: b2Vec2; protected m_invMassB: number; protected m_invIB: number; protected readonly m_mass: b2Mat22; protected readonly m_C: b2Vec2; /** @internal protected */ constructor(def: b2IMouseJointDef); /** Use this to update the target point. */ SetTarget(target: XY): void; GetTarget(): b2Vec2; /** Set the maximum force in Newtons. */ SetMaxForce(force: number): void; /** Get the maximum force in Newtons. */ GetMaxForce(): number; /** Set the linear stiffness in N/m */ SetStiffness(stiffness: number): void; /** Get the linear stiffness in N/m */ GetStiffness(): number; /** Set linear damping in N*s/m */ SetDamping(damping: number): void; /** Get linear damping in N*s/m */ GetDamping(): number; /** @internal protected */ InitVelocityConstraints(data: b2SolverData): void; /** @internal protected */ SolveVelocityConstraints(data: b2SolverData): void; /** @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; ShiftOrigin(newOrigin: XY): void; Draw(draw: b2Draw): void; } //# sourceMappingURL=b2_mouse_joint.d.ts.map