WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-16-2015, 06:25 AM
BSUGeek BSUGeek is offline
Member
 
Join Date: Oct 2014
Posts: 23
Question 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
Reply With Quote
  #2  
Old 03-17-2015, 01:05 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


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


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