WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Lots of Question (https://forum.worldviz.com/showthread.php?t=122)

Karthi 02-19-2004 07:47 PM

Lots of Question
 
Hi,
I need help with quite a few things... i'm not really sure how to do any of them

1) I need to periodically pause my VR world. I want the "simulation" to pause and not stop and restart, as i want it to continue from the point it left off.
(As i am creating a psychology experiment)

2) I want to create a text box which just appears when the "simulation" is paused. This test box has a question. The user uses a joystick to select an approprate respone.

3) I would like to log the responses in an excel file for anlysis. I would like to log, the time of the simulation pause as well as the response as the questions remain the same.

Cheers
karthi

farshizzo 02-20-2004 11:08 AM

Hi Karthi,

1) To pause your simulation you would just need to kill all your timers. Then restart them when you want to resume the simulation. I went ahead and added this feature to Vizard, so it should be available in the next version.

2) You can use the viz.choose command to ask the user a question, however they wouldn't be able to use the joystick to select the answer.

3) There is an example in the tutorial folder that does just this. The file is called tutorial_savedata.py. It simply logs each key press the user makes and the time of the key press into a file.

Good luck!

Karthi 02-20-2004 02:46 PM

Viz.choose
 
HI!
My supervisor really would like the 'participants' to choose their responses using a joystick, as they cannot use the mouse. I know about the 'sid'. Is there a tutorial about how to use this?
Cheers
karthi

farshizzo 02-20-2004 03:24 PM

Hi Karthi,

Here's a script I just wrote that does what you want. It displays a question with two choices. Use the joystick pad to select an option. The selected option will be colored red. Use the trigger button to make your choice.
Code:

import viz
import sid

CHECK_JOYSTICK_MOVE = 0
CHECK_JOYSTICK_CLICK = 1

HIGHLIGHT_COLOR = [1,0,0]
NONHIGHLIGHT_COLOR = [1,1,1]

viz.go()

Question = viz.add(viz.TEXT3D,'Is Vizard Awesome?',viz.SCREEN)
Question.translate(0.5,0.8)
Question.alignment(viz.TEXT_CENTER_CENTER)

Choices = ['Yes','No']
TextList = []
for x in range(0,len(Choices)):
        text = viz.add(viz.TEXT3D,Choices[x],viz.SCREEN)
        text.translate(0.3,0.6-(0.1*x))
        if x == 0:
                text.color(HIGHLIGHT_COLOR)
        else:
                text.color(NONHIGHLIGHT_COLOR)
        TextList.append(text)

SelectedChoice = 0

def mytimer(num):
        global SelectedChoice
        if num == CHECK_JOYSTICK_MOVE:
                y = sid.get()[1]
                if y < -0.3:
                        TextList[SelectedChoice].color(NONHIGHLIGHT_COLOR)
                        SelectedChoice = (SelectedChoice + 1) % len(Choices)
                        TextList[SelectedChoice].color(HIGHLIGHT_COLOR)
                        viz.starttimer(CHECK_JOYSTICK_MOVE,0.5)
                elif y > 0.3:
                        TextList[SelectedChoice].color(NONHIGHLIGHT_COLOR)
                        SelectedChoice = (SelectedChoice - 1) % len(Choices)
                        TextList[SelectedChoice].color(HIGHLIGHT_COLOR)
                        viz.starttimer(CHECK_JOYSTICK_MOVE,0.5)
                else:
                        viz.starttimer(CHECK_JOYSTICK_MOVE,0.01)
        elif num == CHECK_JOYSTICK_CLICK:
                if sid.buttons() & 1:
                        if SelectedChoice == 0:
                                print "You have good taste"
                        else:
                                print "I just plain don't like you"
                        viz.starttimer(CHECK_JOYSTICK_CLICK,0.5)
                else:
                        viz.starttimer(CHECK_JOYSTICK_CLICK,0.01)
       
viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(CHECK_JOYSTICK_MOVE,0.01)
viz.starttimer(CHECK_JOYSTICK_CLICK,0.01)


Karthi 02-20-2004 06:42 PM

Thanks!
I will try this!
Cheers
Karthi


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

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