Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
Using Separator Kits to Create Motion Hierarchies

SoSeparatorKit is a class of node kit. All classes derived from separator kit inherit a part called “childList,” of type SoNodeKitListPart. Through use of the “childList,” separator kits allow you to think in terms of how parts of an object move relative to each other. Each element of the child list is, in turn, an SoSeparatorKit and may contain its own transform node. By nesting separator kits, multiple levels of relative motion can be achieved.

Hierarchical Motion Relationships shows how you might group individual parts that move together. Assume you have already made an individual SoSeparatorKit for each part in a balance scale, shown in Hierarchical Motion Relationships . You want tray1 and string1 to move as a unit, and tray2 and string2 to move as a unit. But when the beam moves, both trays and both strings move with it.

As you arrange these group kits into a hierarchy, you don't need to think in terms of the individual parts each group kit contains (“material,” “complexity,” and so on). You can think of the objects themselves (beam, strings, trays) and how they move relative to each other. The childList for SoSeparatorKit can contain any node derived from SoSeparatorKit, so any type of separator kit is permissible as an entry in this list.

The following code constructs the hierarchy shown in Hierarchical Motion Relationships . A working version of this model is provided in Using Node Kits to Create a Motion Hierarchy at the end of this chapter.

C++ :

scale->setPart( "childList[0]", support );
scale->setPart( "childList[1]", beam );
beam->setPart( "childList[0]", string1 );
beam->setPart( "childList[1]", string2 );
string1->setPart( "childList[0]", tray1 );
string2->setPart( "childList[0]", tray2 );

C# :

scale.SetPart( "childList[0]", support );
scale.SetPart( "childList[1]", beam );
beam.SetPart( "childList[0]", string1 );
beam.SetPart( "childList[1]", string2 );
string1.SetPart( "childList[0]", tray1 );
string2.SetPart( "childList[0]", tray2 );

Java :

scale.setPart( "childList[0]", support );
scale.setPart( "childList[1]", beam );
beam.setPart( "childList[0]", string1 );
beam.setPart( "childList[1]", string2 );
string1.setPart( "childList[0]", tray1 );
string2.setPart( "childList[0]", tray2 );

Hierarchical Motion Relationships