UNPKG

@box2d/debug-draw

Version:

Debug drawing helper for @box2d

91 lines 3.71 kB
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 b2IMotorJointDef extends b2IJointDef { linearOffset?: XY; angularOffset?: number; maxForce?: number; maxTorque?: number; correctionFactor?: number; } /** * Motor joint definition. */ export declare class b2MotorJointDef extends b2JointDef implements b2IMotorJointDef { /** Position of bodyB minus the position of bodyA, in bodyA's frame, in meters. */ readonly linearOffset: b2Vec2; /** The bodyB angle minus bodyA angle in radians. */ angularOffset: number; /** The maximum motor force in N. */ maxForce: number; /** The maximum motor torque in N-m. */ maxTorque: number; /** Position correction factor in the range [0,1]. */ correctionFactor: number; constructor(); /** Initialize the bodies and offsets using the current transforms. */ Initialize(bodyA: b2Body, bodyB: b2Body): void; } /** * 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. */ export declare class b2MotorJoint extends b2Joint { protected readonly m_linearOffset: b2Vec2; protected m_angularOffset: number; protected readonly m_linearImpulse: b2Vec2; protected m_angularImpulse: number; protected m_maxForce: number; protected m_maxTorque: number; protected m_correctionFactor: number; protected m_indexA: number; protected m_indexB: number; protected readonly m_rA: b2Vec2; protected readonly m_rB: b2Vec2; protected readonly m_localCenterA: b2Vec2; protected readonly m_localCenterB: b2Vec2; protected readonly m_linearError: b2Vec2; protected m_angularError: number; protected m_invMassA: number; protected m_invMassB: number; protected m_invIA: number; protected m_invIB: number; protected readonly m_linearMass: b2Mat22; protected m_angularMass: number; /** @internal protected */ constructor(def: b2IMotorJointDef); 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; /** Set the target linear offset, in frame A, in meters. */ SetLinearOffset(linearOffset: b2Readonly<b2Vec2>): void; /** Get the target linear offset, in frame A, in meters. */ GetLinearOffset(): b2Vec2; /** Set the target angular offset, in radians. */ SetAngularOffset(angularOffset: number): void; /** Get the target angular offset, in radians. */ GetAngularOffset(): number; /** Set the maximum friction force in N. */ SetMaxForce(force: number): void; /** Get the maximum friction force in N. */ GetMaxForce(): number; /** Set the maximum friction torque in N*m. */ SetMaxTorque(torque: number): void; /** Get the maximum friction torque in N*m. */ GetMaxTorque(): number; /** Get the position correction factor in the range [0,1]. */ GetCorrectionFactor(): number; /** Set the position correction factor in the range [0,1]. */ SetCorrectionFactor(factor: number): void; /** @internal protected */ InitVelocityConstraints(data: b2SolverData): void; /** @internal protected */ SolveVelocityConstraints(data: b2SolverData): void; /** @internal protected */ SolvePositionConstraints(_data: b2SolverData): boolean; } //# sourceMappingURL=b2_motor_joint.d.ts.map