Create nHair constraints

 
 
 

You can use nConstraints with nHair to style, position, and hold hair curves. When creating constraints, be aware of the following behaviors:

See also Constraining Nucleus objects.

Create an nHair Transform constraint

You can create a Transform constraint to hold specific nHair curves CVs in place or move them through XYZ space.

To create an nHair Transform constraint

  1. In the scene view, select the hair curve CVs you want to constrain. See Select curve components for nConstraints.
  2. In the nDynamics menu set, select nConstraint > Transform.

    The nHair curve CVs you selected are now constrained to their current positions in X, Y, and Z space, and a Transform constraint locator is created for the selected nHair curve components.

    The curves are also now connected to the nHair system's Nucleus solver through a dynamicConstraint node.

    The preset properties on the dynamicConstraint node determine the constraint’s type (in this case, a Transform constraint) and how it behaves. For example, you can create a Transform constraint with the following attribute settings:

    • Spring as the Constraint Method
    • All to First as the Component Relation
    • Within Max Distance as the Connection Method

      Within Max Distance works well with nHair Transform constraints.

    See dynamicConstraintShape.

  3. (Optional) Parent the Transform constraint's dynamicConstraint node under the skeleton model to ensure that constraint moves with an animated character.

Creating an nHair Component to Component constraint

You can create a Component to Component constraint to attach hair system curves to other nHair curves or to other Nucleus objects components. For example, you can constrain selected hair curve CVs to the vertices of a passive collision hair clip or barrette so that it holds the hair in place.

  1. In the scene view, select the hair curve CVs you want to constrain. See Select curve components for nConstraints.
  2. Select the target components of the Nucleus object to which you want to constrain the selected hair curve CVs. If you select edges or faces, then all their vertices will be constrained to the hair.
    Note

    If you selected target components on a non-Nucleus object, that object will be made a passive object when the constraint is created.

  3. In the nDynamics menu set, select nConstraint > Component to Component.

    The hair curve CVs you selected are now constrained to the selected target vertices, and they are now connected to the nHair system's Maya Nucleus solver through a dynamicConstraint node.

    The preset properties on the dynamicConstraint node determine the constraint’s type (in this case, a Component to Component constraint) and how it behaves. For example, you can create a Component to Component constraint with the following attribute settings:

    • Spring as the Constraint Method
    • All to All as the Component Relation
    • Nearest Pairs as the Connection Method

    See dynamicConstraintShape.

Creating an nHair Point to Surface constraint

You can create a Point to Surface constraint to attach hair curve CVs to a target surface such as a deforming nCloth surface, or a passive collision object. For example, you can use a Point to Surface constraint to hold an nCloth hat or head-band to a character's hair.

To create an nHair Point to Surface constraint

  1. In the scene view, select the hair curve CVs you want to constrain. See Select curve components for nConstraints.
  2. -select the target surface to which you want to constrain the hair curves components.

    The target surface can be an nCloth or passive object, or a non-Nucleus polygon mesh.

    Note

    If you selected a target surface that is a nCloth or passive collision object, the surface will be made a passive object when the constraint is created.

  3. In the nDynamics menu set, select nConstraint > Point to Surface.

    The nHair curves components you selected are now constrained to the selected target surface, and they are now connected to the nHair system's Maya Nucleus solver through a dynamicConstraint node.

    The preset properties on the dynamicConstraint node determine the constraint’s type (in this case, a Point to Surface constraint) and how it behaves. For example, you can create a Point to Surface constraint with the following attribute settings:

    • Spring as the Constraint Method
    • Object to Object as the Constraint Relation
    • All to First as the Component Relation
    • Within Max Distance as the Connection Method
    • At Start as the Connection Update

    See dynamicConstraintShape.

Creating an nHair Slide on Surface constraint

You can create a Slide on Surface constraint to attach hair curve CVs to a target surface, such as an nCloth or a passive collision object surface, and allow the constrained curve components to move or slip along the surface to which it is constrained. You can use a Slide on Surface constraint instead of collisions, and in most cases it works faster than collisions. For example, you can Slide on Surface constrain constrain hair curves to a Nucleus object so that the objects attract each other without colliding.

Note
  • If you use a Slide on Surface constraint in the place of collisions for an nHair object, then turn off Collide in the hairSystemShape node's Attribute Editor tab. Otherwise, both collisions and the constraint will be calculated.
  • If you use a Slide on Surface constraint in the place of collisions for nHair, then you can not effectively use Collision Layers to control which members of your Maya Nucleus system can collide with the constrained hair curves.

To create an nHair Slide on Surface constraint

  1. In the scene view, select the hair curve CVs you want to constrain. See Select curve components for nConstraints.
  2. -select the target surface to which you want to constrain the hair curve components.

    The target surface can be an nCloth or passive object, or a non-Nucleus polygon mesh.

    Note

    If you selected a target surface that is a nCloth or passive collision object, the surface will be made a passive object when the constraint is created.

  3. In the nDynamics menu set, select nConstraint > Slide on Surface.

    The nHair curves components you selected are now constrained to the selected target surface, and they are now connected to the nHair system's Maya Nucleus solver through a dynamicConstraint node.

    The preset properties on the dynamicConstraint node determine the constraint’s type (in this case, a Slide on Surface constraint) and how it behaves. For example, you can create a Slide on Surface constraint with the following attribute settings:

    • Spring as the Constraint Method
    • Object to Object as the Constraint Relation
    • All to First as the Component Relation
    • Within Max Distance as the Connection Method
    • Per Frame as the Connection Update
    • Turn on Local Collide properties

    See dynamicConstraintShape.

Creating a Force Field constraint

You can create a Force Field constraint to push nHair curve CVs away from the center of the constraint, in a radial field with spherical volume bounds. For example, you can push out specific hair curves to create a general shape for a hair style.

To create a Force Field constraint

  1. In the scene view, select the hair curve CVs you want to constrain. See Select curve components for nConstraints.
  2. In the nDynamics menu set, select nConstraint > Force Field.

    The Force Field locator appears near the selected hair curves, and the dynamicConstraint node appears in the Attribute Editor.

  3. Adjust the location, size and rotation of the Force Field constraint using Maya’s Move, Scale, and Rotate tools.

    The location, size, and rotation of the locator determines the size, shape and volume of the force field constraint.

  4. (Optional) Adjust the Force, Strength and Strength Dropoff attributes on the dynamicConstraint node to determine the power of the force field. Positive values cause the force field to push out, while negative values cause the force field to suck in hair curves.

Related topics