smallarrows.GIF

156 syllabus      site index      3D artists      past student work        DMA

Unity VR Maya nCloth Dynamics & Blend Shape Deformers

ncloth_blend

Tutorial animated Maya Ncloth curtain and blend shapes imported  into Unity.
Assignment 1 by Isaiah Baiseri


In Maya:  Make a curtain
Switch to the Modeling Module
modeling_module

Create a snakey curve in the top view.
    
Create->Curve Tools->CV Curve Tool->
boxicon.gif   Curve degree: 3 Cubic

Select the curve.

Select Surfaces->Extrude->option.jpg
Choose Style: Distance
Input your  Extrude Length:  8
Choose Direction: Specify
Choose the Y Axis
Choose Output geometry: Polygons
     Choose Quads
     Choose Tessellation method: General
     Change U type to: Per span # of iso params
     Change V type to: Per span # of iso params
     Input Number U: 3   (If this is too jaggy, increase)
     Input Number V: 3
Click Extrude



Add nCloth dynamics
Switch to theFX Module
fx_module 

Select the curtain
Choose nCloth->Create nCloth

Constrain the curtain to an imaginary curtain rod
Select the top row of vertices
Select nConstraint->Transform Constraint

Add wind
Select the curtain
Bring up the Attribute Editor
Arrow over to the nucleus1 tab
     Under Gravity and Wind

          Change Wind Speed to 4
          Change Wind Direction to 1, 0, 1



Use the simulation to model
Make at least 3 copies from various frames of the animation:
Play the animation.
Hit the play arrow on the time slider to play and stop when you like a model. timesliderplay.jpg
Select the curtain
Choose Edit->Duplicate   Ctrl d
Choose Display->Hide Selection   Ctrl h

The copy will not have any dynamics. Do this 3 times

Delete the original nCloth nucleus and curves
Use Display->Show All to show the hidden copies
Keep the 3 duplicated curtain meshes

1 will be the base shape
Name the other 2 curtains curtain1 and curtain2



Remove invisible nCloth nodes that mess you up in Unity:
Do this before animating if you are making a blend shape for Unity.
Select File->Optimize Scene Size->option
     Select Remove: Unknown nodes

Or if that did not work when you bring the files to Unity, try this:
Select one shape at a time
Select Windows->General Editors->Hypergraph: Connections
     Select the light grey node
     Hit delete
     Close the Connection window
Repeat for each shape



Blend Shape
Switch to the Modeling or the Animation Module
modeling_module  or  animation_module

Select the first curtain (base)
Choose Anim Deform->Blend Shape
(This adds blend shapes options in the channel editor)

Select curtain1 (target), use shift to select the first curtain(base) too.
(The order is important)

Choose Anim Deform-> Blend Shape->Add
Do this again for curtain2

Delete the target curtains.

Select the curtain
Open blendShape1 in the Channel Box
Animate the channel named after the second curtain between 0 and 1

The timeline should be the length of your animation.

Choose File->Save As select  Desktop->Maya_Tutorial->Assets
(Or the name of your Unity Project folder.)  Maya scene files will transfer straight into your Unity file.

Any animated items should be separate Maya files. It will be easier to manage



In Unity:
Import SteamVR

Type SteamVR in the search bar
unity_VR_steam_plugin
Add the SteamVR Player Prefab to your scene
Select the SteamVR folder from the Project tab
Select the arrow, open InteractionSystem, open Core, select Prefabs
Drag the Player into the Hierarchy tab



Add your Maya File to your scene
Select the Maya file in the Assets list
Select the Model tab in the Inspector
Change the Scale Factor to .3
Uncheck Import Cameras
Hit
Apply

unity_import_scale

Drag your Maya file from the Assets list over to the Hierarchy tab.



Pause the animation until selected, and loop
The example loops the animations continuously, no pause.
Select your Maya Model in Assets

Switch to the Rig tab in the Inspector
     Change Animation Type to Legacy  (default was Generic)
     Hit Apply
Switch to the Animation tab
Rename Take 001 to a unique name
Select Wrap Mode Loop, twice, I don't know why twice...
     Hit Apply

Select the Maya Model in the Hierarchy
     Uncheck Play Automatically in the Inspector



Add Interaction to stop and start the animation loop
Select the Maya Model in the Hierarchy
    Add Component->Physics->Collider 
     Choose the closest shape.
     You may need to Edit the shape using Edit Collider in the Inspector.

Use Add Component

     Search for inter
     Select Interactable Button Events
Hit the + under On Trigger Down () in the Inspector

Drag and drop Maya Model from the Hierarchy
onto None (obj) in the Inspector
Click the drop down menu reading No function and choose  Animation->CrossFade
Type Take 001 (use the new unique name) in the empty box below

steam_interact_anim_ball

You can now test your scene by selecting the Play arrow. Your animated object will start its animation when you grab it with a trigger.
unity_play_arrow


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
EXAMPLE

http://classes.dma.ucla.edu/Fall20/156-1/projects/examples/ncloth_blend_Isaiah_Baiseri_player



:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Publish WebGL
http://users.design.ucla.edu/~cariesta/MayaCourseNotes/html/webgl.html



:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

smallarrows.GIF