WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   about triggering action (https://forum.worldviz.com/showthread.php?t=5698)

haohaoxuexi1 04-19-2016 12:06 PM

about triggering action
 
Is that possible to set up something like this:

Firstly I press keyboard "A" after that I press keyboard "C"

Then one action is triggered.

And this two step is in a order, the first one has to be activated first them do the second one, after that the action is triggered.

Is that any sample code for this?

haohaoxuexi1 04-19-2016 12:31 PM

The input is not constricted to keyboard, also for other input

Jeff 04-20-2016 01:39 AM

You could use a viztask function to wait for one event and then another before an action is triggered. The following code shows this with key events:

Code:

import viz
import viztask
import vizact

viz.go()

piazza = viz.addChild('piazza.osgb')

avatar = viz.addAvatar('vcc_male2.cfg',pos=[-3,0,5])
avatar.state(1)
walk = vizact.walkTo([3,0,5])

viz.move([0,0,-4])

def triggerAction():
       
        yield viztask.waitKeyDown('a')
        yield viztask.waitKeyDown('c')
        avatar.runAction(walk)
       
viztask.schedule( triggerAction() )



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

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