Foot Tracking

Find Example in ExampleScripts- Foot_Tracking and also as an option in the Walk the Plank demo. For most setups this would involve strapping the hand controllers to your feet using something like these straps, but can also use vive trackers. To adjust the position of the feet more precisely, can modify the leftFoot and rightFoot.osgb models in sightlab_resources/objects. If head height is off may need to re-do your room setup, or could also adjust height optionally in the code using 

transportNode = vizconnect.getTransport('main_transport').getNode3d()

transportNode.setPosition([x,y,z])

This can be added to any script using the following code:

import sightlab_utils.sightlab as sl

from sightlab_utils.settings import *


USE_HANDS = False

VIVE_TRACKERS = False

USE_COLLISION = True


#Setup SightLab Options

sightlab = sl.SightLab(gui = False)


env = vizfx.addChild("sightlab_resources/example_resources/pit_raised.osgb")

sightlab.setEnvironment(env)

env.visible(viz.OFF)


#set number of trials

sightlab.setTrialCount(1)


sightlab.setAvatarLeftHand(leftHand = vizfx.addChild(os.path.join(viz.res.getVizardPath(),'bin/lib/site-packages/sightlab_utils/resources/avatar/hands/empty.osgb')))

sightlab.setAvatarRightHand(rightHand = vizfx.addChild(os.path.join(viz.res.getVizardPath(),'bin/lib/site-packages/sightlab_utils/resources/avatar/hands/empty.osgb')))


rightFoot = vizfx.addChild('sightlab_resources/objects/rightShoe.osgb')

leftFoot = vizfx.addChild('sightlab_resources/objects/leftShoe.osgb')

transportNode = vizconnect.getTransport('main_transport').getNode3d()

#print('Head Pos',transportNode.getPosition())


rightFoot.setParent(transportNode)

leftFoot.setParent(transportNode)


if VIVE_TRACKERS:

import steamvr

tracker = steamvr.getTrackerList()[0]

tracker2=steamvr.getTrackerList()[1]

else:

tracker = vizconnect.getTracker('r_hand_tracker').getNode3d()

tracker2= vizconnect.getTracker('l_hand_tracker').getNode3d()


trackerLink = viz.link(tracker,rightFoot)

trackerLink2 = viz.link(tracker2,leftFoot)


#If wanting to be able to use gravity

if USE_COLLISION:

from sightlab_utils import collision

c = collision.Collision()

rightFoot.disable(viz.INTERSECTION)

leftFoot.disable(viz.INTERSECTION)


if USE_HANDS:

from sightlab_utils import handTrackingOpenXR


def sightLabExperiment():

while True:

yield viztask.waitKeyDown(' ')

env.visible(viz.ON)

yield sightlab.startTrial()

def printFeetPosition():

print('RFoot',leftFoot.getPosition())

print('LFoot',rightFoot.getPosition())

vizact.onkeydown('t',printFeetPosition)


yield viztask.waitKeyDown(' ')

yield sightlab.endTrial()


viztask.schedule(sightlab.runExperiment)

viztask.schedule(sightLabExperiment)

viz.callback(viz.getEventID('ResetPosition'), sightlab.resetViewPoint)