WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
Old 04-25-2005, 01:25 AM
exhale exhale is offline
Join Date: Feb 2005
Posts: 19
multiple timer trouble


I'm having trouble using multiple timers. One is for handling keyboard input to control the viewpoint.

The other is created when a hotspot is entered and is used to move a certain object at a certain rate.

The problem is, when i enter the hotspot, the infinite timer (used for keybcontrol) seems to call the function for moving the object (which is supposed to be run only 100 times), and it does not call the keyboard handling function.

So on entering hotspot, keyboard handling stops, and the object keeps moving. (while it should only do 100 steps).

(btw i used different ID's for both timers)

I included the script as an attachment.

thx in advance,

Attached Files
File Type: txt 01.txt (2.5 KB, 1798 views)
Reply With Quote
Old 04-25-2005, 10:00 AM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849
Hi Kevin,

You can only have one function registered with a timer callback at a time. What you will need to do is combine your mytimer and keybcontrols functions to look something like the following:
def mytimer(timerNum):
	if timerNum == 0:
		if viz.iskeydown(viz.KEY_UP):
		if viz.iskeydown(viz.KEY_DOWN):
		if viz.iskeydown(viz.KEY_RIGHT):
		if viz.iskeydown(viz.KEY_LEFT):
	elif timerNum == 1:
		pos = tbox.get(viz.POSITION) 
		z = pos[2] - 0.01
		print 'z: ', z
Reply With Quote
Old 04-26-2005, 12:21 AM
exhale exhale is offline
Join Date: Feb 2005
Posts: 19

Ow, so that's how the ID works.
I had tried a few things with it, but hadnt
got it to work.

Thank you a lot!


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

All times are GMT -7. The time now is 01:17 AM.

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