HomeWeb Components API Reference - v0.17.0
    Preparing search index...

    Class JointComponentElement

    The JointComponentElement interface provides properties and methods for manipulating <pc-joint> elements. The JointComponentElement interface also inherits the properties and methods of the HTMLElement interface.

    The entity holding the joint is not itself constrained. Its world transform defines the joint frame — the anchor point and axes the constraint operates about — with the local X axis as the primary axis: a hinge rotates about it, a slider translates along it and a ball joint twists about it. The constrained bodies are referenced by entity-a and entity-b, both of which need a rigid body component; leaving entity-b empty constrains entity-a to a fixed point in world space. The underlying engine component is in alpha, so its API may change.

    break - Fired when the impulse on the joint exceeds break-impulse and the constraint breaks. A broken joint no longer constrains its bodies; calling refreshFrames() on the underlying component re-attaches it. Bubbles and is composed.

    Engine component: JointComponent (joint).

    Hierarchy (View Summary)

    Index
    • get angularEquilibrium(): Vec3

      Gets the rest angle of the joint's angular springs.

      Returns Vec3

      The angular spring rest angles.

    • set angularEquilibrium(value: Vec3): void

      Sets the rest angle of a 6dof joint's angular springs in degrees per axis, used on axes with a non-zero angular-stiffness.

      Parameters

      • value: Vec3

        The angular spring rest angles.

      Returns void

    • get angularMotionX(): MotionMode

      Gets how the joint constrains rotation about its X axis.

      Returns MotionMode

      The X axis rotational degree of freedom.

    • set angularMotionX(value: MotionMode): void

      Sets how a 6dof joint constrains rotation about its X axis. Can be locked, limited or free. Defaults to locked.

      Parameters

      • value: MotionMode

        The X axis rotational degree of freedom.

      Returns void

    • get angularMotionY(): MotionMode

      Gets how the joint constrains rotation about its Y axis.

      Returns MotionMode

      The Y axis rotational degree of freedom.

    • set angularMotionY(value: MotionMode): void

      Sets how a 6dof joint constrains rotation about its Y axis. Can be locked, limited or free. Defaults to locked.

      Parameters

      • value: MotionMode

        The Y axis rotational degree of freedom.

      Returns void

    • get angularMotionZ(): MotionMode

      Gets how the joint constrains rotation about its Z axis.

      Returns MotionMode

      The Z axis rotational degree of freedom.

    • set angularMotionZ(value: MotionMode): void

      Sets how a 6dof joint constrains rotation about its Z axis. Can be locked, limited or free. Defaults to locked.

      Parameters

      • value: MotionMode

        The Z axis rotational degree of freedom.

      Returns void

    • get breakImpulse(): number

      Gets the impulse above which the joint breaks.

      Returns number

      The break impulse.

    • set breakImpulse(value: number): void

      Sets the impulse in newton seconds above which the joint breaks. Defaults to Infinity, which makes the joint unbreakable.

      Parameters

      • value: number

        The break impulse.

      Returns void

    • get closestApp(): AppElement | null

      The nearest ancestor <pc-app> element, or null if this element has no <pc-app> ancestor. The search starts at the parent, so an element never resolves to itself.

      Returns AppElement | null

      The closest app element, or null.

    • get closestEntity(): EntityBaseElement | null

      The nearest ancestor element that fronts an entity — <pc-entity>, <pc-model> or <pc-node> — or null if this element has no such ancestor. The search starts at the parent, so an element never resolves to itself.

      Returns EntityBaseElement | null

      The closest entity-fronting element, or null.

    • get enableCollision(): boolean

      Gets whether collision is enabled between the two constrained bodies.

      Returns boolean

      Whether collision is enabled.

    • set enableCollision(value: boolean): void

      Sets whether collision is enabled between the two constrained bodies.

      Parameters

      • value: boolean

        Whether collision is enabled.

      Returns void

    • get enabled(): boolean

      Gets the enabled state of the component.

      Returns boolean

      The enabled state of the component.

    • set enabled(value: boolean): void

      Sets the enabled state of the component.

      Parameters

      • value: boolean

        The enabled state of the component.

      Returns void

    • get enableLimits(): boolean

      Gets whether the limits of the joint are enforced.

      Returns boolean

      Whether the limits are enforced.

    • set enableLimits(value: boolean): void

      Sets whether the limits of a hinge, slider or ball joint are enforced.

      Parameters

      • value: boolean

        Whether the limits are enforced.

      Returns void

    • get entityA(): string

      Gets the reference to the <pc-entity> providing the first constrained body.

      Returns string

      The first body's entity reference.

    • set entityA(value: string): void

      Sets the reference (CSS selector, element id or entity name) to the <pc-entity> providing the first constrained body. The reference resolves when it is set, so an entity created later is picked up by setting the attribute again.

      Parameters

      • value: string

        The first body's entity reference.

      Returns void

    • get entityB(): string

      Gets the reference to the <pc-entity> providing the second constrained body.

      Returns string

      The second body's entity reference.

    • set entityB(value: string): void

      Sets the reference (CSS selector, element id or entity name) to the <pc-entity> providing the second constrained body, or empty to constrain the first body to a fixed point in world space. The reference resolves when it is set, so an entity created later is picked up by setting the attribute again.

      Parameters

      • value: string

        The second body's entity reference.

      Returns void

    • get limits(): Vec2

      Gets the rotation or travel limits of the joint.

      Returns Vec2

      The rotation or travel limits.

    • set limits(value: Vec2): void

      Sets the lower and upper limit of a hinge joint's rotation in degrees, or a slider joint's travel in meters, applied when enable-limits is set.

      Parameters

      • value: Vec2

        The rotation or travel limits.

      Returns void

    • get linearEquilibrium(): Vec3

      Gets the rest point of the joint's linear springs.

      Returns Vec3

      The linear spring rest points.

    • set linearEquilibrium(value: Vec3): void

      Sets the rest point of a 6dof joint's linear springs in meters per axis, used on axes with a non-zero linear-stiffness.

      Parameters

      • value: Vec3

        The linear spring rest points.

      Returns void

    • get linearLimitsX(): Vec2

      Gets the translation limits of the joint along its X axis.

      Returns Vec2

      The X axis translation limits.

    • set linearLimitsX(value: Vec2): void

      Sets the lower and upper translation limit of a 6dof joint along its X axis in meters, used when linear-motion-x is limited.

      Parameters

      • value: Vec2

        The X axis translation limits.

      Returns void

    • get linearLimitsY(): Vec2

      Gets the translation limits of the joint along its Y axis.

      Returns Vec2

      The Y axis translation limits.

    • set linearLimitsY(value: Vec2): void

      Sets the lower and upper translation limit of a 6dof joint along its Y axis in meters, used when linear-motion-y is limited.

      Parameters

      • value: Vec2

        The Y axis translation limits.

      Returns void

    • get linearLimitsZ(): Vec2

      Gets the translation limits of the joint along its Z axis.

      Returns Vec2

      The Z axis translation limits.

    • set linearLimitsZ(value: Vec2): void

      Sets the lower and upper translation limit of a 6dof joint along its Z axis in meters, used when linear-motion-z is limited.

      Parameters

      • value: Vec2

        The Z axis translation limits.

      Returns void

    • get linearMotionX(): MotionMode

      Gets how the joint constrains translation along its X axis.

      Returns MotionMode

      The X axis linear degree of freedom.

    • set linearMotionX(value: MotionMode): void

      Sets how a 6dof joint constrains translation along its X axis. Can be locked, limited or free. Defaults to locked.

      Parameters

      • value: MotionMode

        The X axis linear degree of freedom.

      Returns void

    • get linearMotionY(): MotionMode

      Gets how the joint constrains translation along its Y axis.

      Returns MotionMode

      The Y axis linear degree of freedom.

    • set linearMotionY(value: MotionMode): void

      Sets how a 6dof joint constrains translation along its Y axis. Can be locked, limited or free. Defaults to locked.

      Parameters

      • value: MotionMode

        The Y axis linear degree of freedom.

      Returns void

    • get linearMotionZ(): MotionMode

      Gets how the joint constrains translation along its Z axis.

      Returns MotionMode

      The Z axis linear degree of freedom.

    • set linearMotionZ(value: MotionMode): void

      Sets how a 6dof joint constrains translation along its Z axis. Can be locked, limited or free. Defaults to locked.

      Parameters

      • value: MotionMode

        The Z axis linear degree of freedom.

      Returns void

    • get maxMotorForce(): number

      Gets the maximum torque or force of the joint's motor.

      Returns number

      The maximum motor torque or force.

    • set maxMotorForce(value: number): void

      Sets the maximum torque in newton meters of a hinge joint's motor, or the maximum force in newtons of a slider joint's motor, where 0 disables the motor.

      Parameters

      • value: number

        The maximum motor torque or force.

      Returns void

    • get motorSpeed(): number

      Gets the target speed of the joint's motor.

      Returns number

      The motor's target speed.

    • set motorSpeed(value: number): void

      Sets the target speed of a hinge joint's motor in degrees per second, or a slider joint's motor in meters per second, active while max-motor-force is greater than 0.

      Parameters

      • value: number

        The motor's target speed.

      Returns void

    • get swingLimitY(): number

      Gets the maximum swing of the joint around the joint frame's Y axis.

      Returns number

      The Y axis swing limit.

    • set swingLimitY(value: number): void

      Sets the maximum swing of a ball joint around the joint frame's Y axis in degrees, applied when enable-limits is set.

      Parameters

      • value: number

        The Y axis swing limit.

      Returns void

    • get swingLimitZ(): number

      Gets the maximum swing of the joint around the joint frame's Z axis.

      Returns number

      The Z axis swing limit.

    • set swingLimitZ(value: number): void

      Sets the maximum swing of a ball joint around the joint frame's Z axis in degrees, applied when enable-limits is set.

      Parameters

      • value: number

        The Z axis swing limit.

      Returns void

    • get twistLimit(): number

      Gets the maximum twist of the joint about its primary axis.

      Returns number

      The twist limit.

    • set twistLimit(value: number): void

      Sets the maximum twist of a ball joint about its primary axis in degrees, applied when enable-limits is set.

      Parameters

      • value: number

        The twist limit.

      Returns void

    • Called when the element is fully initialized and ready. Subclasses should call this when they're ready. Resolves the ready promise and dispatches a bubbling, composed ready event. Signals at most once per readiness cycle: a repeat call before _resetReady has re-armed the promise does nothing.

      Returns void

    • Returns the ready promise to its pending state. Subclasses should call this when the resource their readiness announced is torn down (typically from disconnectedCallback), so that a later re-initialization can signal readiness again. Does nothing while the promise is still pending — an in-flight waiter carries over to the next readiness cycle rather than being stranded on a promise nothing will ever resolve.

      Returns void

    • Returns the data the component is created with. Overridden by subclasses to supply the initial values of their cached properties.

      Returns {
          angularDamping: Vec3;
          angularEquilibrium: Vec3;
          angularLimitsX: Vec2;
          angularLimitsY: Vec2;
          angularLimitsZ: Vec2;
          angularMotionX: MotionMode;
          angularMotionY: MotionMode;
          angularMotionZ: MotionMode;
          angularStiffness: Vec3;
          breakImpulse: number;
          enableCollision: boolean;
          enableLimits: boolean;
          entityA: Entity | null;
          entityB: Entity | null;
          limits: Vec2;
          linearDamping: Vec3;
          linearEquilibrium: Vec3;
          linearLimitsX: Vec2;
          linearLimitsY: Vec2;
          linearLimitsZ: Vec2;
          linearMotionX: MotionMode;
          linearMotionY: MotionMode;
          linearMotionZ: MotionMode;
          linearStiffness: Vec3;
          maxMotorForce: number;
          motorSpeed: number;
          swingLimitY: number;
          swingLimitZ: number;
          twistLimit: number;
          type: JointType;
      }

      The initial component data.

    • Returns a promise that resolves with this element when it's ready. This is the low-level primitive underlying whenReady, which is the recommended way to wait for elements.

      Readiness tracks the element's current lifecycle: once a ready element is torn down (for example by removing it from the document), this returns a fresh promise that resolves when the element is next ready. A promise obtained earlier stays resolved — call this again after re-inserting an element rather than reusing a promise from before its removal.

      Returns Promise<JointComponentElement>

      A promise that resolves with this element when it's ready.