Vizard 8 » Tutorials & Examples » 3D models » Coordinate Systems » Tutorial: Querying Position
8.1

Tutorial: Querying Position

Key Concepts

 

Explanation

The next section gives some hard numbers regarding the position difference we can see between the pigeons by demonstrating the use of the getPosition method. Add and run the following code, then take a look at the output:

# default argument of getPosition is viz.ABS_PARENT
print("childPigeon's position offset from parent:", childPigeon.getPosition())
print("worldPigeon's position offset from parent:", worldPigeon.getPosition())

# Get the position in viz.ABS_GLOBAL not the default,viz.ABS_PARENT
print("childPigeon's global position:", childPigeon.getPosition(viz.ABS_GLOBAL))
print("worldPigeon's global position:", worldPigeon.getPosition(viz.ABS_GLOBAL))

Calling getPosition without any arguments uses the default argument viz.ABS_PARENT (absolute parent) and retrieves the position offset encoded in the node's transformation matrix without any modification.  Notice that the value returned by getPosition is the same for both pigeons. When the first parameter of getPosition is supplied with viz.ABS_GLOBAL (absolute global) it returns the node's position relative to the global/world origin.  Thus, as we can see when we look at the world, childPigeon's global position is different than worldPigeon's.  

Different Coordinate Systems

Node Parents

Querying Position

Transform Modes

Relative Position Change