prVectorConstraint

prVectorConstraint Node Plug-in for Maya

download

Introduction

prVectorConstraint plugin is a powerful tool developed for Maya by Mohammad Jafarian that simplifies the process of creating complex custom rigs such as skirts, collars, or sleeves. Traditionally, rigging such components involved using various techniques like IK solvers, RBF solvers, angle calculations, normalization, and mesh-related operations like ray casting or closestPointOnMesh. While these methods have their merits depending on the project requirements, they often involve creating multiple nodes and can be time-consuming. The prVectorConstraint plugin aims to streamline this process by providing a single node that simplifies the rigging workflow.

Features

  • create a constraint based on the angle between the 2 vectors.
  • Enables secondary motion by adjusting the spring attribute.
  • Configurable settings for driver and driven joint ranges, spring intensity, stiffness, damping, output rotation and translate weights, and influence parameters.

Input Parameters

  • driverMin & driverMax: Defines the range of angles in which the driver’s joint triggers the driven joints.
  • min & max: Specifies the range of angles in which the driven joint should rotate.
  • start Frame: Determines the frame at which the spring effect should be enabled.
  • spring Intensity: Controls the overall effect of the spring.
  • spring Stiffness: Determines the rigidity of the spring effect.
  • Spring Damping: Dampens the spring effect, with higher values causing the spring to settle faster.
  • output RotateWeight: Sets the weight of the output rotate value.
  • output TranslateWeight: Sets the weight of the output translate value.
  • radius Power: Sets the radius of influence.
  • falloff Power: Sets the falloff of influence.

License

prVectorConstraint is under the terms of the MIT License

Copyright (C) 2017-2023 Mohammad Jafarian

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Installation

  1. Download the plugin files.
  2. Drag and drop the dragDropInstaller.py file into the Maya viewport.
  3. A new menu called “prRigTools” will appear in the Maya Menu. If you don’t see this menu, ensure that “perseus” is enabled in the plugin manager.

Usage

Create a circle curve, then under prRigTools Menu, click on the Vector Constraint, Set the driver’s joints count.

To create custom rigs using the prVectorConstraint by Python, follow the steps below:

1. Skirt Rig

import maya.cmds as cmds
name = 'skirt'
driverJnts = 2
drivenJnts = 32

# Create a circle curve for the skirt
cmds.circle(n=name, c=(0, 0, 0), ch=1, d=3, ut=0, sw=360, s=drivenJnts, r=1, tol=0.01, nr=(0, 1, 0))
cmds.setAttr('%s.ty' % name, 4.0)

# Generate driver joints on the curve
cmds.prVectorJntsOnCrv(d=driverJnts)
cmds.setAttr("%s_driver0_rootJntEnv.translateZ" % name, -0.5)
cmds.setAttr("%s_driver1_rootJntEnv.translateZ" % name, 0.5)

# Enable spring on the driven joints
cmds.setAttr("skirt_driver0_rootJnt.springIntensity", 1)
cmds.setAttr("skirt_driver1_rootJnt.springIntensity", 1)

2. Sleeve Rig

import maya.cmds as cmds
name = 'sleeve'
driverJnts = 1
drivenJnts = 16

# Create a circle curve for the sleeve
cmds.circle(n=name, c=(0, 0, 0), ch=1, d=3, ut=0, sw=360, s=drivenJnts, r=0.5, tol=0.01, nr=(0, 1, 0))
cmds.setAttr('%s.t' % name, 0.0, 5.0, -5.0)
cmds.setAttr('%s.r' % name, 90.0, 0.0, 0)

# Generate driver joints on the curve
cmds.prVectorJntsOnCrv(d=driverJnts)
for i in range(drivenJnts):
  cmds.setAttr('{0}{1}_drivenJnt_grp.rx'.format(name, i), 90)

cmds.setAttr("{0}_driver0_rootJnt.outputRotateWeight".format(name), 0.0)
cmds.setAttr("{0}_driver0_rootJnt.outputTranslateWeight".format(name), 1.0)

3. Collar Rig

import maya.cmds as cmds
name = 'collar'
driverJnts = 1
drivenJnts = 16

# Create a circle curve for the collar
cmds.circle(n=name, c=(0, 0, 0), ch=1, d=3, ut=0, sw=360, s=drivenJnts, r=1.5, tol=0.01, nr=(0, 1, 0))
cmds.setAttr('%s.t' % name, 0.0, 15.0, 0.0)
cmds.setAttr('%s.r' % name, -160.0, 0.0, 0)

# Generate driver joints on the curve
cmds.prVectorJntsOnCrv(d=driverJnts)
for i in range(drivenJnts):
  cmds.setAttr('{0}{1}_drivenJnt_grp.rx'.format(name, i), 90)

cmds.setAttr("{0}_driver0_rootJnt.outputRotateWeight".format(name), 0.75)
cmds.setAttr("{0}_driver0_rootJnt.outputTranslateWeight".format(name), 1.0)