To create a 3D scene with more than one 3D object, you must set up a hierarchy of 3D object relationships. The 3D object that you use to wire the reference for all objects to the 3D picture control terminal or, if you configure a scene window, the Scene property, is the parent of all other objects in the 3D scene. 3D objects that you add to the scene by wiring a reference to the object to a higher object in the hierarchy are child 3D objects.
If a 3D object is the parent of another 3D object, any transformations you apply to the object also affect the children of that 3D object. Child 3D objects can also be parents of children beneath them in the relationship hierarchy. You can use object relationships in large 3D scenes to program more efficiently and for 3D scenes that involve related movement.
Complete the following steps to create a 3D scene with multiple objects.
Remove the wire that connects the 3D object to the 3D picture control terminal.
Right-click the reference output of the Set Drawable method and select Create»Method for SceneObject Class»Object»Add Object from the shortcut menu to create the Object:Add Object method.
Add the Object:Add Object method to the right of the Set Drawable method and wire the reference output of the Set Drawable method to the reference input of the Object:Add Object method.
Wire the reference output of the Object:Add Object method to the 3D picture control terminal. The 3D object becomes the parent 3D object.
Add another Create Object VI to the block diagram to the left of the Object:Add Object method.
Add Find
Right-click the Scene:New Object output of the Create Object VI and select Create»Method for SceneObject Class»Set Drawable from the shortcut menu to create another Set Drawable method.
Add the new Set Drawable method between the Create Object VI and the Object:Add Object method, and wire the Scene:New Object output of the Create Object VI to the reference input of the Set Drawable method.
Select any VI from the Geometries palette and add it to the block diagram to the left of the Set Drawable method.
Wire the New xxx Refnum output of the Geometries VI you selected to the Drawable input of the Set Drawable method.
(Optional) Translate the new 3D object to another location in the 3D scene. Add the Translate Object VI to the block diagram.
Add Find
Wire the reference output of the new Set Drawable method to the Scene.Object In input of the Translate Object VI
Right-click the Translation input of the Translate Object VI, select Create»Constant from the shortcut menu, and change the values of the constant to the x, y, and z coordinates that you want to use to translate the child object.
Wire the Scene.Object Out output of the Translate Object VI to the Object input of the Object:Add Object method.
Note If you do not translate additional objects that you add to a 3D scene, the 3D objects that you do not translate appear on top of each other, and may be difficult to see.
If you did not complete step 11, wire the reference output of the new Set Drawable method to the Object input of the Object:Add Object method.
The following block diagram shows a 3D scene with two 3D objects.
Refer to the 3D Model of Solar System VI in the labview\examples\Graphics and Sound\3D Picture Control directory for an example of a 3D scene with multiple object relationships.