Preparing search index...

    Class HairVisual

    Used to simulate and render hairstyles with realistic lighting and physics.

    //@input Component.HairVisual hair

    var width = 1;
    var wind = new vec3(5,0,0);

    script.hair.onInitialized = InitializeHair;

    function InitializeHair(hv){
    //change hair width
    hv.strandWidth = width;

    //add wind to hair
    hv.windEnabled = true;
    hv.windForce = wind;
    }

    Hierarchy (View Summary)

    Index

    Properties

    clumpDensity: number

    Density of each clump, higher number would result in "messier" looking hair.

    0
    
    clumpRadius: number

    Offset amount of hair roots.

    0.5
    
    clumpTipScale: number

    Offset amount of hair tips.

    0
    
    colliders: ColliderComponent[]

    List of all colliders assigned to the hair simulation of the current hair visual.

    Lens Scripting Version 138

    []
    
    collisionEnabled: boolean

    Determines if collision is enabled for hair.

    true
    
    collisionFriction: number

    Determines amount of friction for collision between hair strands.

    1
    
    collisionOffset: number

    Determines how much position offset collision will cause.

    1
    
    collisionStiffness: number

    Determines how stiff the collision is.

    5
    
    damp: number

    Higher value of damp will cause hair to have less free movement.

    Lens Scripting Version 138

    5
    
    density: number

    Amount of density created to thicken hair.

    0
    
    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    true
    
    extentsTarget: ScreenTransform

    When a ScreenTransform is present on this SceneObject, and extentsTarget is a child of this SceneObject, extentsTarget will be repositioned to match the exact area this MeshVisual is being rendered. Very useful for Image and Text components.

    null
    
    fallbackHairMaterial: Material

    Use HairVisual#hairMaterial instead. The fallback material is no longer needed.

    Lens Scripting Version 138

    null
    
    fallbackModeEnabled: boolean

    This enables fallback mode which turns off physics simulations; it is recommended to enable fallback mode on lower-end devices. It will be enabled automatically if device doesn't support hair simulation feature.

    false
    
    friction: number

    Amount of friction for hair strands.

    Lens Scripting Version 138

    0.2
    
    gravity: vec3

    Gravity force that gets added for hair's physics simulation.

    Lens Scripting Version 138

    (0, -1, 0)
    
    hairMaterial: Material

    Material used by this simulation to render hair.

    null
    
    hairResolution: number

    Determines the amount of vertices on each strand. 0 means using original number of the strands. 1 is the smallest resolution for hair. Keep in mind when you change this property, the hair geometry will be regenerated.

    0
    
    horizontalAlignment: HorizontalAlignment

    When a ScreenTransform is attached to the same SceneObject, this controls how the mesh will be positioned horizontally depending on stretchMode.

    HorizontalAlignment.Center
    
    isBeingDestroyed: boolean

    Returns true if this Component is currently being destroyed. Becomes true as soon as destruction begins via Component#destroy or destruction of its owning SceneObject, before any OnDestroyEvent callbacks fire.

    Lens Scripting Version 364

    if (!script.isBeingDestroyed) {
    // Component is still fully alive
    }
    isEnabledInHierarchy: boolean

    Returns true if this Component, its SceneObject, and all of that SceneObjects parents are enabled.

    meshShadowMode: MeshShadowMode

    None = 0, Caster = 1, Receiver = 2

    MeshShadowMode.None
    
    noise: number

    Offset of hair density.

    0
    
    onInitialized: (hairVisual: HairVisual) => void

    This function gets called when the hair visual is initialized in the Lens.

    Lens Scripting Version 138

    null
    
    primaryHairMaterial: Material

    Use HairVisual#hairMaterial instead.

    null
    
    renderOrder: number

    The order in which the visual should be rendered.

    Lens Scripting Version 323

    0
    
    sceneObject: SceneObject

    The SceneObject this component is on.

    selfCollisionEnabled: boolean

    If enabled, hair strands will collide with themselves.

    false
    
    selfCollisionFriction: number

    Friction of collisions between hair strands.

    Lens Scripting Version 138

    1
    
    selfCollisionRadius: number

    Radius limit of collisions between hair strands.

    2
    
    selfCollisionStiffness: number

    Determines how stiff collision between hair strands are.

    1
    
    shadowColor: vec4

    Affects the color of shadows being cast by this MeshVisual. The color of the cast shadow is a mix between shadowColor and the material's base texture color. The alpha value of shadowColor controls the mixing of these two colors, with 0 = shadowColor and 1 = shadowColor * textureColor.

    (1, 1, 1, 1)
    
    shadowDensity: number

    Density of shadows cast by this MeshVisual.

    1
    
    stiffness: number

    Higher value of stiffness will make hair move less.

    0.1
    
    strandTaper: number

    The taper size of each hair towards the tip.

    0
    
    strandWidth: number

    The Width of each hair strand.

    Lens Scripting Version 138

    1
    
    stretchMode: StretchMode

    When a ScreenTransform is attached to the same SceneObject, this controls how the mesh will be stretched relative to the ScreenTransform's boundaries.

    StretchMode.Stretch
    
    uniqueIdentifier: string

    Lens Scripting Version 176

    verticalAlignment: VerticalAlignment

    When a ScreenTransform is attached to the same SceneObject, this controls how the mesh will be positioned vertically depending on stretchMode.

    VerticalAlignment.Center
    
    windEnabled: boolean

    If checked will add wind force to hair simulation.

    false
    
    windForce: vec3

    Amount of wind force added to hair simulation.

    Lens Scripting Version 138

    (1, 0, 0)
    

    Methods

    • Adds a collider to the simulation.

      Parameters

      Returns void

      Lens Scripting Version 138

    • Removes all hair colliders from the hair simulation.

      Returns void

      Lens Scripting Version 138

    • Returns true if hair simulation is supported by the device.

      Returns boolean

      Lens Scripting Version 138

    • Returns true if the hair resources are initialized.

      Returns boolean

      Lens Scripting Version 138

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    • Range maximum of the local-space axis-aligned bounding box (AABB) of the visual.

      Returns vec3

      Lens Scripting Version 156

    • Range minimum of the local-space axis-aligned bounding box (AABB) of the visual.

      Returns vec3

      Lens Scripting Version 156

    • Removes a collider from the simulation by index and returns it.

      Parameters

      • index: number

      Returns ColliderComponent

      Lens Scripting Version 138

    • Resets the simulation. May be called if the object with the hair simulation is toggled between enabled and disabled.

      Returns void

      Lens Scripting Version 138

    • Sets the order of this Visual in the render queue.

      Parameters

      • value: number

      Returns void

    • Projects screen positions from camera's view onto the mesh's UVs. If the MeshVisual's material uses the same texture as the camera input, the MeshVisual will look identical to the part of the screen it covers.

      Parameters

      Returns void

    • Range maximum of the world-space axis-aligned bounding box (AABB) of the visual.

      Returns vec3

      Lens Scripting Version 156

    • Range minimum of the world-space axis-aligned bounding box (AABB) of the visual.

      Returns vec3

      Lens Scripting Version 156