WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   vizconnect and track the position of real human movement (https://forum.worldviz.com/showthread.php?t=5947)

tianmoran 01-25-2017 01:13 PM

vizconnect and track the position of real human movement
 
Dear all,

I recently need to use Polhemus to track the head and shoulder movement of the real human. But actually, I don't know how to do it with Polhemus.

I checked the vizconnect tutorial and tried to first do this with my keyboard and mouse (as Polhemus is currently unavailable), but couldn't find a way to record the position of my keyboard or mouse or the avatar I added.

Then a friend sent me the codes:
Code:

import viz
import vizinput
import time

global mark1, mark2, mark3, mark4
polhemus = viz.add('polhemus.dle')               
mark1 = polhemus.addLiberty()                       
mark2 = polhemus.addLiberty()                       
mark3 = polhemus.addLiberty()                       
mark4 = polhemus.addLiberty()                       

def WriteResults_Time(mark1,mark3,mark4,fileName):
        now = viz.tick()                                               
        HeadPos = mark1.getPosition()
        HeadRot = mark1.getEuler()
        LeftHandPos = mark3.getPosition()
        LeftHandRot = mark3.getEuler()
        RightHandPos = mark4.getPosition()
        RightRot = mark4.getEuler()
               
        Save_results = open(fileName,'Avatar')
                       
        vars = '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' %(
        numTrial, now,
        HeadPos[0], HeadPos[1], HeadPos[2],
        HeadRot[0], HeadRot[1], HeadRot[2],
        LeftHandPos[0], LeftHandPos[1], LeftHandPos[2],
        LeftHandRot[0], LeftHandRot[1], LeftHandRot[2],
        RightHandPos[0], RightHandPos[1], RightHandPos[2], 
        RightHandRot[0], RightHandRot[1], RightHandRot[2])
        Save_results.write(vars)

vizact.ontimer(0,Polhemus_Record)

Because I couldn't try those codes with my keyboard or mouse, so just want to ask is there anything I need to change? Or are there any solution for me to track the movement of real person and apply it onto an avatar?

Many thanks!


All times are GMT -7. The time now is 04:22 PM.

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