WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   Regarding switching between viewpoints of 2 different vizconnects files (

rajnishv 03-20-2017 04:39 AM

Regarding switching between viewpoints of 2 different vizconnects files
Hi Jeff,
I am using 2 vizconnect in my vizard script.
I am able to switch between 8 viewpoints of the same 1 single vizconnect.
But i am having problem to switch between viewpoint from 1st vizconnect to the viewpoint of the 2nd vizconnect.

I have tested and changed the viewpoints using a single vizconnect using the following code for 8 different viewpoints for same vizconnect:


import viz
import vizact
import vizconnect
import viztask

# start the vizconnect session stored in the given directory

# oriMode sets what the viewpoint is resetting to. For example...
# matches orientation of the display to the orientation of the viewpoint
# matches orientation of the feet to the orientation of the viewpoint
# matches orientation of the base object (transport, avatar, tracker) to the orientation of the viewpoint
# Similar for posMode
oriMode = vizconnect.VIEWPOINT_MATCH_DISPLAY
posMode = vizconnect.VIEWPOINT_MATCH_FEET

# Add a viewpoint.
vp1 = vizconnect.addViewpoint(        pos=[-13.24803, 12.28260, 8.83578],
                                                                euler=[90, 0, 0],
vp2 = vizconnect.addViewpoint(        pos=[-17.24803, 4.28260, 5.83578],
                                                                euler=[90, 0, 0],
# Displays are added to viewpoints, the viewpoint will traverse the scenegraph to
# determine if the display is attached to an avatar, tracker, etc in order to
# perform the requested resets.

# add an environment

display = vizconnect.getDisplay()

def viewTask():
        while True:
                print'before 1st waitkeydown '
                yield viztask.waitKeyDown(' ')
                print'before 2nd waitkeydown '
                yield viztask.waitKeyDown(' ')
viztask.schedule( viewTask() )

For Ex:

1st Vizonnect - vizconnect.go('vizconnectfile 1') with viewpointFirst=vizconnect.addViewpoint(..)

2nd Vizonnect - vizconnect.go('vizconnectfile 2') with viewpointSecond=vizconnect.addViewpoint(...)

Now i have to switch between viewpoints 'viewpointFirst' and 'viewpointSecond' and vice versa.

Note:I am loading a single Vizconnect one at a time using a def function():

Pls assist further

Jeff 03-21-2017 01:33 AM

What is the reason for using two vizconnect files and are you adding a different display in each file?

rajnishv 03-21-2017 01:54 AM

3 Attachment(s)
Yes Jeff. i am using 2 different vizconnect files with 2 displays -custom Window..
What i am doing.
1)On Load i am calling Vizconnect 1 to add a viewpoint 'vpStart' and the viewpoint data is correct
2)Then on event i am calling Vizconnect 2 to add a viewpoint 'vpFloor' and the viewpoint is correct
3)The issue is here when again when i am calling again vizconnect 1(going back) to again add the same viewpoint 'vpStart',the viewpoint data is wrong.

I am using vizconnects such that when moving forward the vizconnects are adding viewpoints correctly but when i am coming back again to load vizconnect the viewpoint gives [0,0,0] with some eulers which is not correct.

Some Questions:
-Whats may be the problems?
-Do i have to use only 1 vizconnect ?
-What may be the solutions to the problems.

The code producing the issue is attached in the post

PFA of the 2 vizconnect files and the mainVizardPython Script File.

Pls assist me further.

Jeff 03-21-2017 02:01 AM

What is the reason for setting this up with two different vizconnect files? Perhaps you could add all the components you need to a single file and then change parent/child relationships if necessary.

All times are GMT -7. The time now is 05:14 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC