WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-01-2004, 10:59 AM
spacefarer spacefarer is offline
Member
 
Join Date: Dec 2004
Location: Cambridge, MA
Posts: 17
viewpoint movement

Hi!

I would like to move my view point smoothly 1m per pressing an button and to rotate it 90 degrees if I press another button, and wrote a program shown as below.

But there are two major problems.
1. The viewpoint does'nt rotate exactly 90 degrees (like 89.999925...). I want it to rotate just 90 degrees evey time.
2. If you press the button during the view point is changing, the view point moves 1m or rotates 90 degrees from the moment.
I want the [x,y,z] of the view point to be always integer when the view point stops.

I would appreciate your suggestions.
Thank you.

------
def mykeyboard(key):
pos = viz.get(viz.HEAD_POS)
tx = pos[0]
ty = pos[1]
tz = pos[2]
trans = viz.get(viz.BODY_LOOK)
# Translate_Forward
if viz.iskeydown(viz.KEY_UP):
tx = tx + trans[0]
ty = ty + trans[1]
tz = tz + trans[2]
view.goto(tx,ty,tz,1,viz.TIME)
# Yaw_Right
elif viz.iskeydown('6'):
viz.starttimer(1, 0.01,89)

def mytimer(num):
if num == 2: #Yaw-Right
view.rotate(0,1,0,1,viz.BODY_ORI,viz.RELATIVE_LOCA L)
-------
Reply With Quote
 


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 06:33 PM.


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