WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-29-2014, 07:10 AM
Anastaggra Anastaggra is offline
Member
 
Join Date: Jan 2014
Posts: 1
Getting updated position

Hi all,

I am new to Vizard and still learning..
So, I am trying to move point of view from one position to another position using fluid movement (vizact.goto) and after the view point is moved to a new location, I need to get the the new coordinate of the view.
I wrote the following code:


viz.MainView.setPosition([10,2,3])
view = viz.MainView #grab the coordinate of main view
seq1 = vizact.goto([10,2,15]),3,viz.SPEED, pivot = [0,2,0], ori_mask = viz.BODY_ORI)

#execute action on key down
vizact.onkeydown(' ', view.runAction, seq1)

#get the current position after movement of view point
x,y,z = view.getPosition()
print "Your current position is", x,y,z


The problem is, instead of getting the position of view after the goto command ([10,2,15]), the getPosition always return the original position.
Is there any way that I can update the coordinate of the variable 'view' each time after an action is executed.

Thank you very much for all your help.
Reply With Quote
  #2  
Old 02-01-2014, 12:15 AM
Frank Verberne Frank Verberne is offline
Member
 
Join Date: Mar 2008
Location: Netherlands
Posts: 148
Hi Anastaggra,

There is a simple solution for your problem. The problem is that with the code you provided, your variables x,y, and z are set once the code runs, and not updated when the position of the viewpoint is updated. What you need to do is to update x,y, and z after you have pressed the spacebar. So instead of running only the action, you also need to update x,y, and z. See below for an example using a sample environment that comes with Vizard:
Code:
import viz
import vizact

viz.go()
viz.add('gallery.ive')

viz.MainView.setPosition([0,1,0])
view = viz.MainView #grab the coordinate of main view
seq1 = vizact.goto([0,2,2],3,viz.SPEED, pivot = [0,2,0], ori_mask = viz.BODY_ORI)
 
#get the current position after movement of view point
x,y,z = view.getPosition()
print "Your current position is", x,y,z

def moveView():
	view.runAction(seq1)
	#get the current position after movement of view point
	x,y,z = view.getPosition()
	print "Your current position is", x,y,z

#execute action on key down
vizact.onkeydown(' ', moveView)
Good luck!
Frank
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
Set Mouse Position javadi Vizard 2 11-19-2013 03:59 AM
How to pass only 1 axis of the position signal from the source to the dest in a LINK? Zhi Vizard 2 04-04-2013 07:28 AM
Getting Position Lynnifer Vizard 1 07-16-2012 09:49 AM
Dynamic Position and Radius of Sphere hotshotiguana Vizard 1 03-23-2011 12:53 PM
writing joystick position to a data file Saz Vizard 3 12-17-2008 05:18 AM


All times are GMT -7. The time now is 06:44 AM.


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