WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-25-2017, 08:27 AM
JohnSenior JohnSenior is offline
Member
 
Join Date: Apr 2017
Posts: 4
How to calculate a distance between a moving Avatar and the viewpoint?

Dear smart Forum member,

I need to calculate the distance between the position of Avatars, moving from waypoint to waypoint, and the position of the user. At the end of each trial, the minimum distance between viewpoint of the user and avatar at any given time point of the trial should be printed out. I got this far in regard of calculating the distance towards a stable object (at 0.4, 1.8, 0; in this case):
-------------------------
# Globals
pos = []
minDist = 10000
posModel = [0.4,1.8,0]

#euklidische Distanz
def dist(posModel):
global minDist
pos = viz.MainView.getPosition()
dist = [(a - b)**2 for a, b in zip(pos, posModel)]
dist = math.sqrt(sum(dist))
if dist < minDist:
minDist = dist
print minDist
print dist

vizact.ontimer(0.1,dist, posModel)

def quit():
global minDist
print minDist
viz.quit()

vizact.onkeydown('q',quit)

------------------------
My problem: How do I get the position of Avatars, while they are moving from waypoint to waypoint? Is there a way to get the Position of moving avatars similar to "viz.MainView.getPosition()" for the Position of the user?

Best,
John
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 01:07 PM.


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