UNPKG

@box2d/debug-draw

Version:

Debug drawing helper for @box2d

184 lines 7.43 kB
import { b2Vec2, XY } from "../common/b2_math"; import { b2Joint, b2JointDef, b2IJointDef } from "./b2_joint"; import { b2SolverData } from "./b2_time_step"; import { b2Body } from "./b2_body"; import { b2Draw } from "../common/b2_draw"; import { b2Readonly } from "../common/b2_readonly"; export interface b2IWheelJointDef extends b2IJointDef { /** The local anchor point relative to bodyA's origin. */ localAnchorA?: XY; /** The local anchor point relative to bodyB's origin. */ localAnchorB?: XY; /** The local translation axis in bodyA. */ localAxisA?: XY; /** 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. */ maxMotorTorque?: number; /** The desired motor speed in radians per second. */ motorSpeed?: number; /** Suspension stiffness. Typically in units N/m. */ stiffness?: number; /** Suspension damping. Typically in units of N*s/m. */ damping?: number; } /** * Wheel 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 b2WheelJointDef extends b2JointDef implements b2IWheelJointDef { /** 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 axis in bodyA. */ readonly localAxisA: b2Vec2; /** 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. */ maxMotorTorque: number; /** The desired motor speed in radians per second. */ motorSpeed: number; /** Suspension stiffness. Typically in units N/m. */ stiffness: number; /** Suspension damping. Typically in units of N*s/m. */ damping: number; constructor(); /** * Initialize the bodies, anchors, axis, and reference angle using the world * anchor and world axis. */ Initialize(bA: b2Body, bB: b2Body, anchor: Readonly<XY>, axis: Readonly<XY>): void; } /** * 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. The spring/damper is * initialized upon creation. This joint is designed for vehicle suspensions. */ export declare class b2WheelJoint extends b2Joint { protected readonly m_localAnchorA: b2Vec2; protected readonly m_localAnchorB: b2Vec2; protected readonly m_localXAxisA: b2Vec2; protected readonly m_localYAxisA: b2Vec2; protected m_impulse: number; protected m_motorImpulse: number; protected m_springImpulse: number; protected m_lowerImpulse: number; protected m_upperImpulse: number; protected m_translation: number; protected m_lowerTranslation: number; protected m_upperTranslation: number; protected m_maxMotorTorque: number; protected m_motorSpeed: number; protected m_enableLimit: boolean; protected m_enableMotor: boolean; protected m_stiffness: number; protected m_damping: number; 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_ax: b2Vec2; protected readonly m_ay: b2Vec2; protected m_sAx: number; protected m_sBx: number; protected m_sAy: number; protected m_sBy: number; protected m_mass: number; protected m_motorMass: number; protected m_axialMass: number; protected m_springMass: number; protected m_bias: number; protected m_gamma: number; /** @internal protected */ constructor(def: b2IWheelJointDef); /** Get the motor speed, usually in radians per second. */ GetMotorSpeed(): number; /** Set/Get the maximum motor force, usually in N-m. */ GetMaxMotorTorque(): number; /** Set spring stiffness */ SetStiffness(stiffness: number): void; /** Get spring stiffness */ GetStiffness(): number; /** Set damping */ SetDamping(damping: number): void; /** Get damping */ 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; /** 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 current joint translation, usually in meters. */ GetJointTranslation(): number; /** Get the current joint linear speed, usually in meters per second. */ GetJointLinearSpeed(): number; /** Get the current joint angle in radians. */ GetJointAngle(): number; /** Get the current joint angular speed in radians per second. */ GetJointAngularSpeed(): number; /** Is the joint motor enabled? */ IsMotorEnabled(): boolean; /** Enable/disable the joint motor. */ EnableMotor(flag: boolean): boolean; /** Set the motor speed, usually in radians per second. */ SetMotorSpeed(speed: number): number; /** Set the maximum motor force, usually in N-m. */ SetMaxMotorTorque(torque: number): void; /** Get the current motor torque given the inverse time step, usually in N-m. */ GetMotorTorque(inv_dt: number): number; /** * Is the joint limit enabled? */ IsLimitEnabled(): boolean; /** * Enable/disable the joint translation limit. */ EnableLimit(flag: boolean): boolean; /** * Get the lower joint translation limit, usually in meters. */ GetLowerLimit(): number; /** * Get the upper joint translation limit, usually in meters. */ GetUpperLimit(): number; /** * Set the joint translation limits, usually in meters. */ SetLimits(lower: number, upper: number): void; Draw(draw: b2Draw): void; } //# sourceMappingURL=b2_wheel_joint.d.ts.map