WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #14  
Old 10-25-2012, 06:20 AM
Kyman2008 Kyman2008 is offline
Member
 
Join Date: Jul 2012
Posts: 19
Ok so I have solved this problem, but the problem of walking around my world has now arised because If I use the link command to link the mainview with the tracker the mainview will automatically jump to a random point in my world corresponding to the millimeter position data it is getting from the optitrack position data. All I want to do is calculate if there is a difference in position data between a small amount of time (i.e. the person moved) and then output this same movement in Vizard. Here is my code currently for connecting my tracker and viz.MainView. (The function for updating euler works, the update position does not work, i.e. I can't walk around my world!!)

###Link Mainview to Sensor and Begin Scene###
def updateView_Euler():

yaw, pitch, roll = headtracker.getEuler()
pitch= pitch - 10
yaw= yaw + 30
viz.MainView.setEuler([-yaw,pitch,0],viz.BODY_ORI)

vizact.ontimer(0,updateView_Euler)

def updateView_Position():

x,y,z= headtracker.getPosition()
x = int(x)*1000
z = int(z)*1000

x2,y2,z2= headtracker.getPosition()
x2 = int(x2)*1000
z2 = int(z2)*1000

delta_x = x2 - x
delta_z = z2 - z

if delta_x > 3 :
viz.MainView.move(delta_x,0,0, viz.BODY_ORI)
if delta_z > 3:
viz.MainView.move(0,0,delta_z, viz.BODY_ORI)


vizact.ontimer(0,updateView_Position)
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:52 AM.


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