![]() |
|
#3
|
|||
|
|||
|
Thanks for the reply. I had looked at tasks initially, but got a little lost in their implementation. After your suggestion that they are the appropriate way to proceed, I took a closer look.
I integrated my task into a hot spot event. When a particular hot spot is entered it executes a hot spot event handler, which schedules the desired task: Code:
# define the hotspot events
SETUP1, SETUP2, TRIAL = 1, 2, 3
def HotSpotHandler(id, x, y, z):
if id == TRIAL:
viztask.schedule(PerformTrialTask)
else:
viz.starthotspot(TRIAL, viz.RECTANGLE_HOTSPOT_IN, 0, 4, 2, .5)
viz.callback(viz.HOTSPOT_EVENT, HotSpotHandler)
viz.starthotspot(SETUP1, viz.RECTANGLE_HOTSPOT_IN, -20, 10, 2, .5)
viz.starthotspot(SETUP2, viz.RECTANGLE_HOTSPOT_IN, 20, 10, 2, .5)
# perform the trial task
def PerformTrialTask():
while True:
# prepare the next setup hot spots
viz.starthotspot(SETUP1, viz.RECTANGLE_HOTSPOT_IN, -20, 10, 2, .5)
viz.starthotspot(SETUP2, viz.RECTANGLE_HOTSPOT_IN, 20, 10, 2, .5)
# move into position
viz.MainView.goto([0, 1.82, 4])
viz.MainView.lookat(PitCover.getPosition())
# process question
yield TrialSubTask()
# sub task to handle question / answer
def TrialSubTask():
while True:
global PromptText
PromptText = viz.addText('What will you do?\n\n\'J\' - Try to jump over.\n\'A\' - Use assistance.', viz.SCREEN, scene=1)
PromptText.setScale([.5, .5, 1])
PromptText.translate(0.05, 0.9)
DataObject = viz.Data
yield viztask.waitEvent(viz.KEYDOWN_EVENT, DataObject)
# process answer
PromptText.remove()
if DataObject.data[0] == 'j':
viz.MainView.goto([0, 1.82, 9], 5, viz.SPEED)
viz.MainView.lookat(0, 1.82, 100)
return;
elif DataObject.data[0] == 'a':
viz.MainView.goto([0, 1.82, 7], 5, viz.SPEED)
viz.MainView.lookat(0, 1.82, 100)
return;
Can you describe how I might prevent that navigation? Let me know if this question isn't specific enough and I'll try again. Thanks, Jason |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| adding more than 1 action for avatar animation slider control | yak | Vizard | 0 | 07-21-2009 12:22 PM |
| orientation question | whj | Vizard | 3 | 01-21-2009 12:22 PM |
| Control of timers | vizmaster | Vizard | 6 | 08-22-2008 10:36 AM |
| General question and question regarding arrays | dan12345 | Vizard | 1 | 01-15-2008 11:15 AM |
| to rephrase my question... | shai | Vizard | 2 | 10-27-2004 11:55 AM |