Vizard 7 » Reference » Linking » Linking basics
7.6

Linking basics

Vizard's linking system allows you to quickly create hierarchical-like relationships between 3D geometry node objects and non-node objects.  Links make a destination object take the position, orientation or scale of a source object.  For example, linking an orientation sensor to a view causes the view to take the orientation of the sensor.  

 

Links can have operators applied to them to offset the destination object's position, orientation or scale.   

Creating links

The linkable Vizard objects are <node3d>, <sensor>, <viewpoint>, <bone>, and <animationpath>. The viz.link(<source object>, <destination object>) method works by adding a task to Vizard's update-cycle to replace the destination object's transform matrix (position, orientation and scale data) with the source object's transform matrix.  By default, links do not affect the scale of the destination object.

sensor = viz.add('testtrack_all.dls') #position and orientation data source
arrow = viz.add('marker.wrl')
#Make the arrow take the position and orientation of sensor
viz.link(sensor, arrow)

Operators: modifying the destination object's transform

You can also associate operators with links to offset the position and orientation of the destination object.  For example, operators allow you to make a view and follow an avatar from an over-the-shoulder perspective rather than at the avatar's exact position. There are two kinds of operators, pre and post.

 

The effective difference between pre and post operations:

#Offset the position of the male from the sensor by applying a post operator
#The postTrans operator translates the destination object's
#position in world coordinates from the source position
arrowLink = viz.link(sensor, arrow)
arrowLink.postTrans([0, 1, 0])

Example Scripts

\examples\linking\basicLinking.py

\examples\linking\grabbing.py

\examples\linking\mergeLinking.py

See also

In this section:

Advanced linking - Discusses the implementation of links with matrix mathematics.

Operators on links- More operator examples and implantation discussion.

Link command table- List of relevant link commands.

Other sections:

Transform Basics- Introduces the position/orientation/scale transforms associated with all 3D nodes.

Example scripts:

Basic linking

Grabbing

Link merging