![]() |
|
#5
|
|||
|
|||
The script is somewhat long, I can e-mail you the file, but here are the gaze relevant parts:
Code:
def loadGazes(): global people, peopleGaze, peopleGazeInit for i in range( NUMBER_PEOPLE ): [ x, y, z ] = peopleAvatars[ i ].getpos() fromCenter = i - NUMBER_PEOPLE/2 degrees = 7 * math.fabs( fromCenter ) if( fromCenter > 0 ): degrees = 360 - degrees y = 1.4 viz.startlayer( viz.LINES ) viz.linewidth( 1 ) gazeOrigin = viz.vertex( x, y, z ) gazeEnd = viz.vertex( x + math.tan( math.radians( degrees ) )*GAZE_LENGTH, y, z + GAZE_LENGTH ) gaze = viz.endlayer() gaze.color( viz.BLUE ) gaze.alpha( 0.3 ) gaze.dynamic() if( i == PARTICIPANT_POSITION ): gaze.visible( False ) peopleGazeInit.append( [ x + math.tan( math.radians( degrees ) )*GAZE_LENGTH, y, z + GAZE_LENGTH ] ) peopleGaze.append( gaze ) Code:
def updateGaze(): global peopleGaze, peopleGazeInit for i in range( NUMBER_PEOPLE ): if( not i == PARTICIPANT_POSITION ): [ yaw, pitch, roll ] = peopleAvatars[ i ].getbone( 'skel_Head' ).get( viz.EULER ) peopleGaze[ i ].vertex( 1, peopleGazeInit[ i ][ 0 ] + math.tan( math.radians( yaw ) )*GAZE_LENGTH, peopleGazeInit[ i ][ 1 ] - math.tan( math.radians( pitch ) )*GAZE_LENGTH, peopleGazeInit[ i ][ 2 ] ) Code:
def timer( timerID ): if( timerID == TIMER_UPDATE_GAZE ): updateGaze() viz.callback( viz.TIMER_EVENT, timer ) Code:
loadGazes() viz.starttimer( TIMER_UPDATE_GAZE, 1.0/10.0, viz.FOREVER ) Code:
import vizinfo import whrandom import math if viz.running(): import sid #has to be imported for the gamepad |
|
|