Hierarchical Models – from 3ds Max to Vizard

Filed under: Media 
Tags:

Models that you use in Vizard can have a hierarchy of sub-parts that are linked through parent/child type relationships. In these hierarchical relationships, the child object inherits the transforms of the parent. The video tutorial in this article will guide you through setting up a simple hierarchical model in 3ds Max to manipulating the various sub-parts in Vizard.

Key point covered in this tutorial are

  • Creating parent/child relationships in Max using links
  • Changing the local origin or pivot point of a sub-part in Max.
  • Getting handles to various sub-parts of the model in Vizard and applying transformations to them.

For the script and model used in the tutorial download: hierarchical-model.zip

The following example code shows how to get a handle to a child object's GEODE, set it's absolute position, and rotate it around it's local origin.

#Get a handle to the object's GEODE
teapot1_GEODE = model.getChild('Teapot01-GEODE')

#Get the child object's absolute position
abs_pos = teapot1_GEODE.getPosition(viz.ABS_GLOBAL)

#Set the child object's absolute position
teapot1_GEODE.setPosition([x,y,z], viz.ABS_GLOBAL)

#Create a spinning action and rotate the child object
#around it's local origin
spin = vizact.spin(0,1,0, 90)
teapot1_GEODE.addAction(spin)