WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 09-20-2004, 02:07 PM
vjonshih vjonshih is offline
Join Date: Sep 2004
Posts: 15
Translate Head Pos to Starting Pos via Key

Hi there,

I'm trying to make a key function to reset the user's HEAD_POS to a starting position in the world. The code I have is like the following:

def mykeyboard(key):
if key == 'a':
viz.translate(viz.HEAD_POS, -0.1439, -.0095, -4.4603, viz.ABSOLUTE_WORLD)

[where (-.1439, .0095, -4.4603) is the exact position I want the user's head to be in when I press the 'a' key]

However, when I do press the 'a' key when I run the script, it ends up translating the head_pos relatively each time (in this case, back a few coordinates on the z-axis). How do I fix this?

Reply With Quote
Old 09-20-2004, 02:13 PM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849

The viz.translate function will only translate the viewpoint relatively. To translate the viewpoint to an absolute location, use the translate command of the main viewpoint:
view = viz.get(viz.MAIN_VIEWPOINT)
view.translate(-0.1439, -.0095, -4.4603)
Look in the <viewpoint> section of the command reference for more information.
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 07:57 AM.

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