<node3d>.setParent

Change the parent of the node

 

<node3d>.setParent(
    parent    
    scene = viz.MainScene    
    node = ''    

)

 

parent

This can be another <node3d> object or one of the following:

viz.WORLD
viz.SCREEN
viz.ORTHO


scene = viz.MainScene

If viz.WORLD or viz.SCREEN is given as the parent, then this parameter specifies which scene to attach the node to.

If viz.ORTHO is given as the parent, then this parameter specifies which window to attach the node to.


node = ''

If parenting to another node3d object, this value specifies the name of the subnode to place this node under. The name must refer to a OSG group node.


Remarks

This command will detach the node from its current parent and attach it to a new parent.

Return Value

None

Example

#Example 1
parent = viz.add('object.wrl')
child = parent.add('object.wrl')
#Detach the child from parent and attach it to the world
child.setParent(viz.WORLD)

#Example 2
parent = viz.add('object.wrl')
child = viz.add('object.wrl')
#Detach the child from the world and add it to parent
child.setParent(parent)

#Example 3
child = viz.add('object.wrl')
#Detach the child from scene 1 and add it to scene 2
child.setParent(viz.WORLD,2)

See also

<node3d>.addParent
<node3d>.removeParent
<node3d>.clearParents