HomeWeb Components API Reference - v0.31.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. A reference can name any entity-fronting element — <pc-entity>, <pc-model> or <pc-node>, so a ragdoll can join a model's own skeleton nodes by name — and a name resolves against the nearest enclosing entity first, then outward through the entity hierarchy, then the document, while a # selector resolves document-wide. A <template> prefab with one entity-fronting root can therefore wire its joints by name and stay self-contained when cloned. 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
    angularDamping: Vec3

    The spring damping of the joint per angular axis. Applies to a 6dof joint, on axes with a non-zero angular-stiffness.

    angularEquilibrium: Vec3

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

    angularLimitsX: Vec2

    The rotation limits of the joint about its X axis. Applies to a 6dof joint, as a lower and an upper limit in degrees, when angular-motion-x is limited.

    angularLimitsY: Vec2

    The rotation limits of the joint about its Y axis. Applies to a 6dof joint, as a lower and an upper limit in degrees, when angular-motion-y is limited.

    angularLimitsZ: Vec2

    The rotation limits of the joint about its Z axis. Applies to a 6dof joint, as a lower and an upper limit in degrees, when angular-motion-z is limited.

    angularMotionX: MotionMode

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

    angularMotionY: MotionMode

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

    angularMotionZ: MotionMode

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

    angularStiffness: Vec3

    The spring stiffness of the joint per angular axis. Applies to a 6dof joint, where 0 disables the spring on that axis.

    breakImpulse: number

    The impulse above which the joint breaks. It is in newton seconds, and defaults to Infinity, which makes the joint unbreakable.

    enableCollision: boolean

    Whether collision is enabled between the two constrained bodies.

    enableLimits: boolean

    Whether the limits of the joint are enforced. Applies to a hinge, slider or ball joint.

    entityA: string

    The reference (a pc-entity, pc-model or pc-node name, or a document-wide # selector) to the element providing the first constrained body. An exact name resolves against the nearest enclosing entity first, then outward, then the document. The reference resolves when it is set, so an entity created later is picked up by setting the attribute again. A non-empty reference that does not resolve warns, naming which of the two causes it hit.

    entityB: string

    The reference (a pc-entity, pc-model or pc-node name, or a document-wide # selector) to the element providing the second constrained body, or empty for the world-space case. Empty constrains the first body to a fixed point in world space. An exact name resolves against the nearest enclosing entity first, then outward, then the document. The reference resolves when it is set, so an entity created later is picked up by setting the attribute again. A non-empty reference that does not resolve warns; an empty one is the documented world-space case and stays silent.

    limits: Vec2

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

    linearDamping: Vec3

    The spring damping of the joint per linear axis. Applies to a 6dof joint, on axes with a non-zero linear-stiffness.

    linearEquilibrium: Vec3

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

    linearLimitsX: Vec2

    The translation limits of the joint along its X axis. Applies to a 6dof joint, as a lower and an upper limit in meters, when linear-motion-x is limited.

    linearLimitsY: Vec2

    The translation limits of the joint along its Y axis. Applies to a 6dof joint, as a lower and an upper limit in meters, when linear-motion-y is limited.

    linearLimitsZ: Vec2

    The translation limits of the joint along its Z axis. Applies to a 6dof joint, as a lower and an upper limit in meters, when linear-motion-z is limited.

    linearMotionX: MotionMode

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

    linearMotionY: MotionMode

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

    linearMotionZ: MotionMode

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

    linearStiffness: Vec3

    The spring stiffness of the joint per linear axis. Applies to a 6dof joint, where 0 disables the spring on that axis.

    maxMotorForce: number

    The maximum torque or force of the joint's motor. It is a torque in newton meters for a hinge joint and a force in newtons for a slider joint, where 0 disables the motor.

    motorSpeed: number

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

    swingLimitY: number

    The maximum swing of the joint's primary axis towards the joint frame's Y axis. Applies to a ball joint, whose primary axis is X, so this is a rotation about Z. It is a half-angle in degrees, applied when enable-limits is set.

    swingLimitZ: number

    The maximum swing of the joint's primary axis towards the joint frame's Z axis. Applies to a ball joint, whose primary axis is X, so this is a rotation about Y. It is a half-angle in degrees, applied when enable-limits is set.

    twistLimit: number

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

    type: JointType

    The type of the joint. Can be fixed, ball, hinge, slider or 6dof. Defaults to fixed.

    • 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 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

    • 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: the value of every attribute in the subclass's schema. Overridden by subclasses that cache their properties themselves, to supply those. The element's enabled state is not among them: the base class adds it when it creates the component.

      Returns object

      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.