q5play
    Preparing search index...

    Class WheelJoint

    A Joint is used to constrain the movement of two sprites relative to each other, which can lead to nuanced physics interactions.

    Hierarchy (View Summary)

    Index

    The Box2D joint ID. Don't change it!

    spriteA: Sprite

    The first sprite in the joint.

    spriteB: Sprite

    The second sprite in the joint.

    type: string

    The type of joint. Can be one of:

    "glue", "distance", "wheel", "hinge", "slider", or "grabber".

    Can't be changed after the joint is created.

    visible: boolean

    Determines whether to draw the joint if spriteA or spriteB is drawn.

    true
    
    • get collideConnected(): boolean

      Set to true if you want the joint's sprites to collide with each other.

      Returns boolean

      false
      
    • set collideConnected(val: boolean): void

      Parameters

      • val: boolean

      Returns void

    • get damping(): number

      Damping is a 0-1 ratio describing how quickly the joint loses vibrational energy.

      0.0 means no damping, 1.0 means critical damping, which will stop the joint from vibrating at all.

      Damping only effects joints that have a springiness greater than 0.

      Returns number

      0.0
      
    • set damping(val: number): void

      Parameters

      • val: number

      Returns void

    • get forceThreshold(): number

      The amount of force that must be applied to the joint before it breaks.

      Setting the threshold too high leads to instability. Use sprite.addCollider to simulate unbreakable bonds between shapes.

      Returns number

      500
      
    • set forceThreshold(val: number): void

      Parameters

      • val: number

      Returns void

    • get limitsEnabled(): boolean

      Whether the joint's suspension limits are enabled. When enabled a min/max distance from resting constrains the joint.

      Returns boolean

      false
      
    • set limitsEnabled(val: boolean): void

      Parameters

      • val: boolean

      Returns void

    • get lowerLimit(): number

      The minimum distance the wheel's suspension can contract from 0, which represents the resting position, when limits are enabled.

      Returns number

    • set range(val: number | [number, number]): void

      The distance the wheel's suspension can contract or extend from 0, which represents the resting position.

      Accepts a number to set a symmetric range or an array with the minimum and maximum length limits.

      Parameters

      • val: number | [number, number]

      Returns void

    • get reactionForce(): any

      How much force the joint is applying to keep the two sprites together.

      Returns any

    • get reactionTorque(): any

      How much torque the joint is applying to keep the two sprites together.

      Returns any

    • get torqueThreshold(): number

      The amount of torque that must be applied to the joint before it breaks.

      Setting the threshold too high leads to instability. Use sprite.addCollider to simulate unbreakable bonds between shapes.

      Returns number

      500
      
    • set torqueThreshold(val: number): void

      Parameters

      • val: number

      Returns void

    • get upperLimit(): number

      The maximum distance the wheel's suspension can extend from 0, which represents the resting position, when limits are enabled.

      Returns number

    • This function is run when the joint's reaction force exceeds the force threshold or its reaction torque exceeds the torque threshold.

      By default, the sprites' speed and rotation speed are set to 0 and the joint is deleted, simulating a break.

      Returns void