WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Unable to move from one scene to another in Vizard? (https://forum.worldviz.com/showthread.php?t=6107)

saravanan.balak 02-11-2018 09:45 PM

Unable to move from one scene to another in Vizard?
 
Dear all

Could you please help me with the following items?

I face some issues on the following:

1. I have four scenes in which, I will have to have a multiple choice questions at the end of each scene. After pressing enter, it should go to Scene 2, followed by multiple choice questions. It should continue for the all the four scenes.

Could anyone please help me with this?

How can I do it?

Thanks,
BS

Jeff 02-12-2018 06:11 AM

Take a look at the viztask module. That will help with setting up the program flow. You can wait for a button event before changing the scene. The designing an experiment tutorial uses a GUI and waits for a button event.

saravanan.balak 02-13-2018 04:40 AM

Could you please share another example?

rajnishv 02-15-2018 08:27 AM

Hi saravanan.balak,

You just need to use the below code to switch between viewpoints by loading and removing the appropriate models at runtime.

Beelow is the code for switching between 2 viewpoints but only one single (you can use 2 models and load and remove/unload at runtime and changes the view points.


Code:

import viz
import vizact
import vizconnect
import viztask


# start the vizconnect session stored in the given directory
vizconnect.go("vizconnect_config.py")

# oriMode sets what the viewpoint is resetting to. For example...
# vizconnect.VIEWPOINT_MATCH_DISPLAY
# matches orientation of the display to the orientation of the viewpoint
#
# vizconnect.VIEWPOINT_MATCH_FEET
# matches orientation of the feet to the orientation of the viewpoint
#
# vizconnect.VIEWPOINT_MATCH_BASE
# 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],
                                                                posMode=posMode,
                                                                oriMode=oriMode,
                                                                constant=False,
                                                                )
vp2 = vizconnect.addViewpoint(        pos=[-17.24803, 4.28260, 5.83578],
                                                                euler=[90, 0, 0],
                                                                posMode=posMode,
                                                                oriMode=oriMode,
                                                                constant=False,
                                                                )
# 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.
#vp1.add(vizconnect.getDisplay())



# add an environment
viz.add('piazza.osgb')

display = vizconnect.getDisplay()

def viewTask():
       
        while True:
                vp1.add(display)
                vizconnect.resetViewpoints()
                print'before 1st waitkeydown '
                yield viztask.waitKeyDown(' ')
                vp1.remove(display)
                vp2.add(display)
                vizconnect.resetViewpoints()
                print'before 2nd waitkeydown '
                yield viztask.waitKeyDown(' ')
                vp2.remove(display)
       
viztask.schedule( viewTask() )

Thanx&Regards

Mr.Rajnish Vishwakarma


All times are GMT -7. The time now is 08:08 AM.

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