rhodonite
    Preparing search index...

    Class VRMSpringBone

    VRM Spring Bone implementation for physics-based bone animation. This class handles the physics simulation of spring bones commonly used in VRM models for secondary animation like hair, clothes, and accessories.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _tags: RnTags = {}

    Collection of tags associated with this object

    boneAxis: Vector3 = ...

    The bone axis direction in local space coordinates

    boneLength: number = 0

    The length of the bone in world space units

    currentTail: MutableVector3 = ...

    Current tail position in world space coordinates

    dragForce: number = 0.4

    The drag force that dampens the bone movement

    gravityDir: Vector3 = ...

    The direction vector of gravity force

    gravityPower: number = 0

    The power of gravity affecting the bone movement

    hitRadius: number = 0.02

    The radius used for collision detection

    initialized: boolean = false

    Flag indicating whether the spring bone has been initialized

    initialLocalChildPosition: Vector3 = ...

    The initial local position of the child bone

    The scene graph entity node that this spring bone is attached to

    prevTail: MutableVector3 = ...

    Previous tail position in world space coordinates

    stiffnessForce: number = 1.0

    The stiffness force that controls how quickly the bone returns to its rest position

    currentMaxObjectCount: number = 0

    Current maximum object count for UID generation

    InvalidObjectUID: -1

    Invalid object UID constant

    Accessors

    • get objectUID(): number

      Gets the unique object identifier

      Returns number

      The object's UID

    • get uniqueName(): string

      Gets the unique name of this object

      Returns string

      The unique name string

    Methods

    • Calculates the bone length in world space coordinates. This method updates the boneLength property based on the current world positions of the bone and its child (or estimated child position).

      Returns void

    • Retrieves a complete tag object (name and value) for the specified tag name

      Parameters

      • tagName: string

        The name of the tag to retrieve

      Returns Tag

      A Tag object containing the name and value

    • Retrieves the value associated with a specific tag name

      Parameters

      • tagName: string

        The name of the tag whose value to retrieve

      Returns any

      The tag value, or undefined if the tag doesn't exist

    • Checks whether this object has a tag with the specified name

      Parameters

      • tagName: string

        The name of the tag to check for

      Returns boolean

      True if the tag exists (value is not null/undefined), false otherwise

    • Checks if this object has a tag with the specified name and value

      Parameters

      • tagName: string

        The tag name to match

      • tagValue: string

        The tag value to match

      Returns boolean

      True if the object has a matching tag, false otherwise

    • Checks if this object has all the specified tags with exactly matching values

      Parameters

      • tags: RnTags

        Object containing tag names as keys and expected values

      Returns boolean

      True if all specified tags exist with matching values, false otherwise

    • Checks if the object's combined tag string contains all the provided search strings. This allows for flexible searching within tag names and values.

      Parameters

      • stringArray: string[]

        Array of strings that must all be present in the combined tag string

      Returns boolean

      True if all strings are found in the combined tag string, false otherwise

    • Attempts to set a tag on this object. If the tag already exists, it will be replaced.

      Parameters

      • tag: Tag

        The tag object containing the name and value to set

      Returns boolean

      True if the tag was successfully set, false if the tag name contains invalid characters

    • Attempts to set a unique name for this object

      Parameters

      • name: string

        The desired unique name

      • toAddNameIfConflict: boolean

        If true, appends UID to make name unique when conflicts occur; if false, fails on conflict

      Returns boolean

      True if the name was successfully set, false if there was a conflict and toAddNameIfConflict was false

    • Validates that a tag string contains only allowed characters (alphanumeric and underscore)

      Parameters

      • val: string

        The string to validate

      Returns boolean

      True if the string contains only valid characters, false if it contains invalid characters

    • Retrieves an RnObject instance by its unique identifier

      Parameters

      • objectUid: number

        The unique identifier of the object to retrieve

      Returns RnObject | undefined

      The RnObject instance or undefined if not found or garbage collected

    • Searches for the first object that has a specific tag with the given value

      Parameters

      • tag: string

        The tag name to search for

      • value: string

        The tag value to match

      Returns WeakRef<RnObject> | undefined

      WeakRef to the first matching object, or undefined if not found