WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-26-2014, 01:18 AM
EKF EKF is offline
Member
 
Join Date: Aug 2012
Posts: 9
Glitch - variable speed, even though a fixed speed has been programmed

Hi
I have Vizard 3 and I'm using a brick wall maze which a programing friend helped to write. People walk through the maze (first person perspective) using the keyboard arrow keys.
This worked fine on my old laptop, but I have just moved Vizard to a new laptop, and the walking speed is now really variable despite it being programmed at a fixed speed. I've uninstalled the antivirus software on the advice of a colleague, but this still doesn't help. I also created .exe files rather than loading directly, and I have the same problem.
Any advice greatly appreciated.
Thanks
Reply With Quote
  #2  
Old 06-26-2014, 02:30 AM
Frank Verberne Frank Verberne is offline
Member
 
Join Date: Mar 2008
Location: Netherlands
Posts: 148
Do you have some sample code that determines the walking speed? Do you also get variable walking speed with other input devices (like a mouse or joystick) or another keyboard? Is the variable walking speed specific to the new laptop; have you tried running the .exe on another (desktop) computer? These are a few questions that come to mind. Especially your code could be the source of your problem.
Reply With Quote
  #3  
Old 06-26-2014, 02:52 AM
EKF EKF is offline
Member
 
Join Date: Aug 2012
Posts: 9
Hi
The problem is specific to this laptop. It works on a very similar laptop (although we initially had a speed issue and removed the antivirus software to solve this). I've also realised that the issue is in one direction only (we have a .txt file as input and east-west is working normalliy, but north-south seems to be exponentially speeding up along the path).

I've pasted our keyboard info below:
def checkKeyboard():
MOVE_SPEED_MULTIPLIER=0.6
ROTATE_SPEED_MULTIPLIER=0.6
tomove = 0
torotate = 0
#print 'viz.key',viz.key

if viz.key.isDown(viz.KEY_UP):
tomove = mazeExptParams.MOVE_SPEED*MOVE_SPEED_MULTIPLIER
elif viz.key.isDown(viz.KEY_DOWN):
tomove = -mazeExptParams.MOVE_SPEED*MOVE_SPEED_MULTIPLIER
elif viz.key.isDown(viz.KEY_RIGHT):
torotate = mazeExptParams.ROTATE_SPEED*ROTATE_SPEED_MULTIPLIE R
elif viz.key.isDown(viz.KEY_LEFT):
torotate = -mazeExptParams.ROTATE_SPEED*ROTATE_SPEED_MULTIPLIE R
elif viz.key == viz.KEY_F1:
torotate = -mazeExptParams.ROTATE_SPEED*ROTATE_SPEED_MULTIPLIE R
viz.move(0,0,tomove)
viz.rotate(viz.BODY_ORI,torotate,0,0)


Thanks
Emily
Reply With Quote
  #4  
Old 06-26-2014, 04:19 AM
EKF EKF is offline
Member
 
Join Date: Aug 2012
Posts: 9
apologies. To add to the code. The code listed above is our 'runMaze' file. We also have this code in our 'MazeExptParams' file:

MOVE_SPEED =0.6
ROTATE_SPEED =1.2


Thanks
Emily
Reply With Quote
  #5  
Old 06-26-2014, 05:58 AM
Erikvdb Erikvdb is offline
Member
 
Join Date: May 2013
Posts: 63
Hi Emily,
Velocity is distance over time. In your code, that last element isn't specified, so I assume Vizard just applies the same translation regardless of how much time has past since updating the last frame. Of course, the problem is that frametimes vary all the time, maybe just very slightly if it runs very stable on one machine, but on other hardware you'll get totally different timings.

Add viz.elapsed() or viz.getFrameElapsed() as an additional multiplier and adjust your MOVE_SPEED_MULTIPLIER accordingly (the new speed is likely going to be very slow)

So try:
Code:
tomove = mazeExptParams.MOVE_SPEED*MOVE_SPEED_MULTIPLIER*viz.getFrameElapsed()
#etc.
And see if that helps.
Reply With Quote
  #6  
Old 06-26-2014, 06:19 AM
EKF EKF is offline
Member
 
Join Date: Aug 2012
Posts: 9
Fantastic, that worked. Thank you very much, I really appreciate it.
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
random speed and associated coding Saz Vizard 1 05-20-2010 04:03 AM


All times are GMT -7. The time now is 02:12 PM.


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