← Back to Docs
  • index.html
  • Clayground
  • Clayground.Character3D
  • Character
  • Clayground 2026.2
  • Character QML Type

    A fully animated 3D humanoid character with modular body parts. More...

    Import Statement: import Clayground.Character3D
    Inherits:

    BodyPartsGroup

    Properties

    Methods

    Detailed Description

    Character is the main component for creating 3D characters with procedural animations. It provides extensive customization through body part dimensions, colors, and automatic walk/run/idle animations.

    The character's origin is at ground level (Y=0 at bottom of feet), centered horizontally. Movement speeds are derived from animation geometry to ensure foot movement matches character movement.

    Example usage:

    import Clayground.Character3D
    
    Character {
        name: "hero"
        activity: Character.Activity.Walking
        skinColor: "#d38d5f"
        torsoColor: "#4169e1"
    }

    See also BodyPartsGroup and ParametricCharacter.

    Property Documentation

    activity : int

    Current activity state. Use Character.Activity enum: Idle, Walking, Running, Using, Fighting.


    armColor : alias

    Arm/sleeve color.


    armDepth : alias

    Depth of the arms.


    armHeight : alias

    Total arm length.


    armLowerTaper : alias

    How much the forearm tapers.


    armUpperRatio : alias

    Upper arm proportion of total arm.


    armWidth : alias

    Width of the arms.


    chinPointiness : alias

    How pointed the chin is (0-1).


    currentSpeed : real [read-only]

    Current movement speed based on activity.


    eyeColor : alias

    Eye color.


    eyeSize : alias

    Eye size multiplier.


    faceActivity : alias

    Current facial expression activity.


    footColor : alias

    Foot/shoe color.


    footDepth : alias

    Depth of the feet.


    footHeight : alias

    Height of the feet.


    footWidth : alias

    Width of the feet.


    hairColor : alias

    Hair color.


    hairVolume : alias

    Hair volume multiplier.


    handColor : alias

    Hand color.


    handDepth : alias

    Depth of the hands.


    handHeight : alias

    Height of the hands.


    handWidth : alias

    Width of the hands.


    head : Head [read-only]

    Reference to the head for animation.


    headHeight : real [read-only]

    Total head height (upper + lower).


    hip : BodyPart [read-only]

    Reference to the hip.


    hipColor : alias

    Hip/pants color.


    hipDepth : alias

    Depth of the hip section.


    hipHeight : alias

    Height of the hip section.


    hipWidth : alias

    Width of the hips.


    idleCycleDuration : int

    Duration of the idle animation cycle in milliseconds.


    leftArm : Arm [read-only]

    Reference to the left arm for animation.


    leftLeg : Leg [read-only]

    Reference to the left leg for animation.


    legColor : alias

    Leg/pants color.


    legDepth : alias

    Depth of the legs.


    legHeight : alias

    Total leg length.


    legLowerTaper : alias

    How much the lower leg tapers.


    legUpperRatio : alias

    Upper leg proportion of total leg.


    legWidth : alias

    Width of the legs.


    lowerHeadDepth : alias

    Depth of the lower head/jaw.


    lowerHeadHeight : alias

    Height of the lower head/jaw.


    lowerHeadWidth : alias

    Width of the lower head/jaw.


    mouthSize : alias

    Mouth size multiplier.


    name : string

    Character identifier name.


    neckHeight : real

    Height of the neck section.


    noseSize : alias

    Nose size multiplier.


    rightArm : Arm [read-only]

    Reference to the right arm for animation.


    rightLeg : Leg [read-only]

    Reference to the right leg for animation.


    runSpeed : real [read-only]

    Running speed derived from animation geometry.


    shoulderWidth : alias

    Width at the shoulders.


    skinColor : alias

    Skin color for head, hands, and feet.


    speaking : bool [read-only]

    True while the character is speaking (text or audio), including between the segments of annotated text.


    speech : Speech [read-only]

    The character's speech engine for advanced configuration (volume, rate, pitch) and signals (started/finished).


    speechBodyLanguage : bool

    Whether emotional speech may use body language gestures.

    When true and the character is otherwise idle, saying something with an emotion plays a matching gesture loop (slumped sway when sad, bouncy arms when happy, agitated pumping when angry). The gestures never override other activities - a walking or fighting character keeps its body animation and only face and voice carry the emotion.


    speechEmotion : string [read-only]

    The emotion of the current speech ("happy", "sad", "angry" or empty for neutral).


    torso : BodyPart [read-only]

    Reference to the torso.


    torsoColor : alias

    Torso/shirt color.


    torsoDepth : alias

    Depth of the torso.


    torsoHeight : alias

    Height of the torso.


    upperHeadDepth : alias

    Depth of the upper head.


    upperHeadHeight : alias

    Height of the upper head.


    upperHeadWidth : alias

    Width of the upper head.


    waistWidth : alias

    Width at the waist.


    walkSpeed : real [read-only]

    Walking speed derived from animation geometry.


    Method Documentation

    void say(string what, string emotion)

    Makes the character say something with lip-synced mouth movement.

    Pass either plain text (spoken via text-to-speech when available, otherwise the mouth animates silently) or a path/URL to a wav/mp3 file which is played back while the mouth follows the audio.

    The optional emotion ("happy", "sad" or "angry") colors the conversation: facial expression, voice pitch/rate (for TTS) and - if the character is idle and speechBodyLanguage is enabled - matching body language. Everything is restored when the speech finishes.

    Text may switch the emotion mid-speech with inline annotations:

    npc.say("*angry* Get off my ground! *happy* Just kidding, come in.")

    Recognized annotations are *happy*, *sad*, *angry* and *neutral* (plus the aliases *joy*, *anger*, *sadness* and *calm*); each one applies from where it appears. The emotion argument sets the tone before the first annotation. Unknown annotations are left in the text untouched.


    void stopSpeaking()

    Interrupts the current speech output.