WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 02-10-2004, 06:24 AM
lucalatini lucalatini is offline
Join Date: Feb 2004
Posts: 5
Progressive Motion Of The Viewpoint


I'm trying to implement navigation with keypresses. I would like to make the viewpoint translate (o rotate) in a smooth and gradual way along a fixed distance (or angle). Thus, I use viz.move and viz.rotate within a cycle. But I have found some problems:

1. Sometimes the cycle does not work correctly. Here is a very simple example (running in Vizard 2.14 also if it is pure Python) to explain the problem.

#----- Example program--------
import math

a = 7.0
for x in range(10):
a = a + 0.1
print a

a = 70
for x in range(10):
a = a + 1
print a

a = 0.70
for x in range(10):
a = a + 0.01
print a
It is interesting to note that the comparison a<value is true when a==7.5 and not when a==75 or 0.75. That is, in the former case the < operator behaves as a <= operator. Maybe I'm missing something obvious, but I don't understand the reason for this difference.

2. In endless_maze demo it is possible to set the velocity of the translation by means of time.clock() used within a timer cycle. The difference between two time recordings is divided by 0.016: why this value? and is there an alternative way to set the velocity of the movement?

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 04:51 PM.

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