I've tried to create another window using two different methods (from both examples in the tutorials and other forum posts) and then assign one of the quads to the left window and the other to the right window. Method one
Code:
import viz
#Import vizjoy module
import vizjoy
import time
import math
import vizact
import vizinfo
import vizshape
viz.displaymode(1024, 768)
viz.go(viz.FULLSCREEN)
viz.mouse(viz.OFF)
vizact.ontimer(32,viz.quit) #runs file for 32 secs
subject = viz.input('What is the participant number?')
#define speed
MOVE_SPEEDl = 0.04459 #hard wired constant for speed gain (30mph)
MOVE_SPEEDr = 0.001
viz.clearcolor(0.5,0.5,0.5)
viz.MainView.setPosition(0,0.5,0)
# Create a new window in the upper left corner
UpperLeftWindow = viz.addWindow(pos=(0,1.0),size=(0.5,0.5))
UpperLeftWindow.visible(0,viz.SCREEN)
UpperLeftView = viz.addView()
UpperLeftWindow.setView(UpperLeftView)
#add the road texture
roadr = viz.add('roadld3.png')
roadl = viz.add('roadld3.png')
#create a texture quad1 to add the road texture to
#and place it over ground
quadr = viz.addTexQuad()
quadr.setScale(1,2,1)
quadr.setPosition(0,0.5,0)
quadr.setEuler(0,90,0)
quadr.texture(roadr)
roadr_position = 0.5
#groundr_position = 0
#create a texture quad left to add the road texture to
#and place it over ground
quadl = viz.addTexQuad()
quadl.setScale(1,2,1)
quadl.setPosition(0,-0.5,0)
quadl.setEuler(0,90,0)
quadl.texture(roadl)
roadl_position = 0
#add right road if getting near the end of road
def addRoadr():
global roadr_position, roadl_position
viewpointr_pos = viz.MainView.getPosition()
#check to see how close the viewpoint is to the end of the road
if roadr_position - viewpointr_pos[2] < 50:
#add 50 meters of road
for i in range(1,50):
quadrcopy = quadr.copy()
quadrcopy.setPosition([0.75,0,roadr_position])
quadrcopy.setEuler(0,90,0)
roadr_position +=1
viz.MainView.move(0,0,MOVE_SPEEDr,viz.BODY_ORI)
addRoadr()
#call a timer every frame to check if road needs to be added
vizact.ontimer(0, addRoadr)
# add left road if getting near to the end of it
def addRoadl():
global roadr_position, roadl_position
viewpointl_pos = viz.MainView.getPosition()
#check to see how close the viewpoint is to the end of the road
if roadl_position - viewpointl_pos[2] < 50:
#add 50 meters of road
for i in range(1,50):
quadlcopy = quadl.copy()
quadlcopy.setPosition([-0.75,0,roadl_position])
#changing the 1st parameter to -0.5 for left quad and
#0.5 for right quad elimates the grey space between the lines
#one solid black road
quadlcopy.setEuler(0,90,0)
roadl_position +=1
viz.MainView.move(0,0,MOVE_SPEEDl,viz.BODY_ORI)
addRoadl()
#call a timer every frame to check if road needs to be added
vizact.ontimer(0, addRoadl)
However this just creates a window which merges the two qaud textures together.
Method 2:
Code:
import viz
#Import vizjoy module
import vizjoy
import time
import math
import vizact
import vizinfo
import vizshape
viz.displaymode(1024, 768)
viz.go(viz.FULLSCREEN)
viz.mouse(viz.OFF)
vizact.ontimer(32,viz.quit) #runs file for 32 secs
subject = viz.input('What is the participant number?')
#define speed
MOVE_SPEEDl = 0.04459 #hard wired constant for speed gain (30mph)
MOVE_SPEEDr = 0.001
viz.clearcolor(0.5,0.5,0.5)
#create 2 windows
#Set main window size to half
viz.MainWindow.setSize(0.5,1)
#Add a new window to other half
window = viz.addWindow()
window.clearcolor (0.5,0.5,0.5)
window.setPosition(0.5,1)
window.setSize(0.5,1)
view = viz.addView()
view.scene(2)
window.viewpoint(view)
#add the road texture
roadr = viz.add('roadld3.png')
roadl = viz.add('roadld3.png')
#create a texture quad1 to add the road texture to
#and place it over ground
quadr = viz.addTexQuad()
quadr.setScale(1,2,1)
quadr.setPosition(0,0.5,0)
quadr.setEuler(0,90,0)
quadr.texture(roadr)
roadr_position = 0.5
#groundr_position = 0
#create a texture quad left to add the road texture to
#and place it over ground
quadl = viz.addTexQuad()
quadl.setScale(1,2,1)
quadl.setPosition(0,-0.5,0)
quadl.setEuler(0,90,0)
quadl.texture(roadl)
roadl_position = 0
#add right road if getting near the end of road
def addRoadr():
global roadr_position, roadl_position
viewpointr_pos = viz.MainView.getPosition()
#check to see how close the viewpoint is to the end of the road
if roadr_position - viewpointr_pos[2] < 50:
#add 50 meters of road
for i in range(1,50):
quadrcopy = quadr.copy()
quadrcopy.setPosition([0.75,0,roadr_position])
quadrcopy.setEuler(0,90,0)
roadr_position +=1
viz.MainView.move(0,0,MOVE_SPEEDr,viz.BODY_ORI)
addRoadr()
#call a timer every frame to check if road needs to be added
vizact.ontimer(0, addRoadr)
# add left road if getting near to the end of it
def addRoadl():
global roadr_position, roadl_position
viewpointl_pos = viz.MainView.getPosition()
#check to see how close the viewpoint is to the end of the road
if roadl_position - viewpointl_pos[2] < 50:
#add 50 meters of road
for i in range(1,50):
quadlcopy = quadl.copy()
quadlcopy.setPosition([-0.75,0,roadl_position])
#changing the 1st parameter to -0.5 for left quad and
#0.5 for right quad elimates the grey space between the lines
#one solid black road
quadlcopy.setEuler(0,90,0)
roadl_position +=1
viz.MainView.move(0,0,MOVE_SPEEDl,viz.BODY_ORI)
addRoadl()
#call a timer every frame to check if road needs to be added
vizact.ontimer(0, addRoadl)
But this will only put both of the quad textures in the left hand window when I want the left quad in the left window, the right one in the right window and both of them to be able to move at independent speeds. Any help would be much appreciated as I've now started randomly crying at strangers.
Thanks!