Here is a sample script that shows how to overlay objects on a sub-window:
Code:
import viz
import vizact
viz.go()
#Add the room and arrow
room = viz.add('gallery.ive')
# Create a new window in the upper left corner
UpperLeftWindow = viz.addWindow(pos=(0,1.0),size=(0.2,0.2))
UpperLeftWindow.visible(0,viz.SCREEN)
# Create a new viewpoint
BirdView = viz.addView()
#Attach the bird's eye view to the upper left window
UpperLeftWindow.setView(BirdView)
#Move the view above the center of the room
BirdView.setPosition([0,9,0])
#Rotate the view so that it looks down
BirdView.setEuler([0,90,0])
#Overlay arrow on sub window (20x20 pixels)
arrow = viz.addTexQuad(parent=viz.ORTHO,scene=UpperLeftWindow,size=20)
arrow.texture(viz.add('arrow.tif'))
def UpdateArrow():
#Get the current head orientation and position
yaw,pitch,roll = viz.MainView.getEuler()
pos = viz.MainView.getPosition()
# Place arrow on top of viewpoint
x,y,z = UpperLeftWindow.worldToScreen(pos,mode=viz.WINDOW_PIXELS)
arrow.setPosition([x,y,0])
# Rotate arrow to match yaw rotation
arrow.setEuler([0,0,-yaw])
vizact.ontimer(0,UpdateArrow)