#1
|
|||
|
|||
Link footsteps to arrow keys
Hi i'm trying to link the footsteps sound to when I use the arrow keys. I want the sound to play whenever the up,down,left, or right keys are pressed and to stop whenever none of them are pressed. how would i do that? thanks
|
#2
|
|||
|
|||
You can register callback functions with vizact.onkeydown and vizact.onkeyup to start and stop the sounds:
Code:
import viz import vizact viz.go() viz.addChild('piazza.osgb') avatar = viz.addAvatar('vcc_male2.cfg',pos=[0,0,6],euler=[180,0,0]) avatar.state(1) def avatarWalk(): avatar.playsound('footsteps.wav',viz.LOOP) avatar.state(2) vizact.onkeydown(viz.KEY_DOWN,avatarWalk) def avatarStop(): avatar.playsound('footsteps.wav',viz.PAUSE) avatar.state(1) vizact.onkeyup(viz.KEY_DOWN,avatarStop) |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to link the Sony HMD to the MainView | armo | Vizard | 4 | 06-08-2014 10:34 AM |
Introducing a rotation offset into a link | EnvisMJ | Vizard | 1 | 11-13-2013 05:51 AM |
Link only one Axis | Andy | Vizard | 7 | 06-18-2013 02:30 AM |
Modeling and Modifying a 3D Arrow | hotshotiguana | Vizard | 4 | 04-10-2012 12:09 PM |
Remove link and have object drop/collide? | cgibb | Vizard | 6 | 03-02-2010 04:18 PM |