WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-26-2008, 10:31 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You are using the vizact.onpick function incorrectly. Here is a sample script that shows how to use it. Clicking a box will slide it to the other side of the screen and set the volume up.
Code:
import viz
viz.go()

viz.clearcolor(viz.GRAY)
viz.mouse(viz.OFF)

#Array of sounds
FILES = ['bounce.wav','carousel.wav','bach_air.mid']

def ToggleBox(box):
	box.active = not box.active
	if box.active:
		box.runAction(vizact.moveTo(pos=box.onPos,speed=20))
		box.audio.volume(1)
	else:
		box.runAction(vizact.moveTo(pos=box.offPos,speed=20))
		box.audio.volume(0)

#Create boxes
boxes = []
for i,f in enumerate(FILES):
	box = viz.add('box.wrl')
	box.audio = viz.addAudio(f,loop=True,volume=0.0)
	box.active = False
	box.offPos = (-2,i*2,10)
	box.onPos = (2,i*2,10)
	box.setPosition(box.offPos)
	vizact.onpick(box,ToggleBox,box)
	boxes.append(box)

#Start sounds
for b in boxes:
	b.audio.play()
Reply With Quote
 

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
Interface with Tobii Eye Tracker Uttama_vizard Precision Position Tracker (PPT) 1 12-12-2007 11:31 AM
Status bar in user interface AlyssaK Vizard 3 10-26-2007 12:05 AM
Basic soundtrack Plymouth Vizard 6 01-30-2007 01:34 AM


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


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