Go to: Synopsis. Return value. Flags. Python examples.

Synopsis

nSoft( selectionList , [convert=boolean], [duplicate=boolean], [duplicateHistory=boolean], [goal=float], [hideOriginal=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

nSoft is undoable, queryable, and NOT editable.

Makes a nSoft body from the object(s) passed on the command line or in the selection list. The geometry can be a NURBS, polygonal, lattice object. The resulting nSoft body is made up of a hierarchy with a particle shape and a geometry shape, thus:

                 
            T    
            / \  
           T   G 
          /      
        P        
                 

Dynamics are applied to the particle shape and the resulting particle positions then drive the locations of the geometry's CVs, vertices, or lattice points.

With the convert option, the particle shape and its transform are simply inserted below the original shape's hierarchy. With the duplicate option, the original geometry's transform and shape are duplicated underneath its parent, and the particle shape is placed under the duplicate. Note that any animation on the hierarchy will affect the particle shape as well. If you do not want them, then reparent the structure outside the hierarchy.

When duplicating, the nSoft portion (the duplicate) is given the name "copyOf" + "original object name". The particle portion is always given the name "original object name" + "Particles."

None of the flags of the nSoft command can be queried. The nSoft -q command is used only to identify when an object is a nSoft body, or when two objects are part of the same nSoft body. See the examples.

Return value

stringarray

In query mode, return type is based on queried flag.

Flags

convert, duplicate, duplicateHistory, goal, hideOriginal
Long name (short name) Argument types Properties
convert(c) boolean create
This tells the command that you want the original object to be the actual deformed object. The particle shape portion of the nSoft body will be inserted in the same hierarchy as the original, under the same parent (with one additional intervening transform which is initially the identity). If no flags are passed, then this is assumed. The combination -c -h 1 is not valid; if you have this in your scripts, remove the -h 1.
duplicate(d) boolean create
This tells the command that you want to make a copy of the original object and use the copy as the deforming geometry. Input connections to the original object are duplicated. You would do this if you wanted to keep the original object in your scene and also have a copy of it that was a nSoft body. This flag and -dh are mutually exclusive.
duplicateHistory(dh) boolean create
This is the same as -d, except that upstream history, is duplicated as well, instead of just input connections. This flag and -d are mutually exclusive.
goal(g) float create
This is the same as -d, but in addition it tells the command that you want the resulting nSoft body to try to follow the original geometry, using the set goal weight as the value that controls how strongly it is to follow it. A value of 1.0 will try to follow exactly, and a value of 0.0 will not follow at all. The default value is 0.5. This value must be from 0.0 to 1.0. You could use -d with -g, but it is redundant. If you want history to be duplicated, you can use -dh and -g together.
hideOriginal(h) boolean create
This flag is used only when duplicating (-d, -g, or -dh). If set to true, whichever of the two objects is NOT the nSoft object will be hidden. In other words, with -d -h true, the original object will be hidden; with -d -c -h 1 the duplicate object will be hidden. You would typically do this if you want to use the non-dynamic object as a goal for the nSoft one (see -g) but you do not want it visible in the scene. The flags -h 1 and -c are mutually exclusive.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

cmds.sphere()
cmds.nSoft( 'nurbsSphere1', c=True )

# Creates a sphere named nurbsSphere1 and converts nurbSphere1 into
# a nSoft object. The particle portion of the nSoft object will
# be parented (with its own transform) under nurbsSphere1.

cmds.sphere()
cmds.nSoft( 'nurbsSphere1', d=True )

# Same as the previous example, except that the nSoft command will make
# a duplicate of nurbsSphereShape1. The resulting nSoft body will be
# completely independent of nurbSphere1 and its children. Input connections
# to nurbsSphereShape1 will be duplicated, but not any upstream history
# (in other words, just plain "duplicate").

cmds.sphere()
cmds.nSoft( 'nurbsSphere1', dh=True )

# Same as the previous example, except that upstream history on
# nurbsSphereShape1 will be duplicated as well (equivalent to
# "duplicate history").

cmds.sphere()
cmds.nSoft( 'nurbSphere1', g=0.3 )

# This will make a duplicate of the shape under nurbSphere1 (as for -d),
# and use it as the shape for the newly created nSoft object.
# The original nurbsSphereShape1 will be made a goal for the particles of
# softy, with a goal weight of 0.3. This will make those particles try to
# follow nurbSphere1 loosely as it moves around.

cmds.nSoft( 'foobar', q=True )
# Returns true if foobar is a nSoft object.

cmds.nSoft( 'foobar', 'foobarParticles', q=True )

# Returns true if foobar and foobarParticles are parts of the same
# nSoft object. This is useful because when you select a nSoft body,
# both the overall transform and the particle transform get put into
# the selection list.