def update(faceServer, time_diff): """ """ global INFO_PERIOD cont = G.getCurrentController() eyes_done = False # threaded server is thread-safe for au, value in faceServer.update(time_diff): if au[0] == '6': # XXX: yes, 6 is an eye prefix (do better ?) if eyes_done: continue # The model is supposed to look towards negative Y values # Also Up is positive Z values ax = -faceServer.get_AU('63.5')[3] az0 = faceServer.get_AU('61.5R')[3] az1 = faceServer.get_AU('61.5L')[3] # No ACTION for eyes G.eye_L.localOrientation = [ [cos(az0), -sin(az0), 0], [cos(ax)*sin(az0), cos(ax)*cos(az0),-sin(ax)], [sin(ax)*sin(az0), sin(ax)*cos(az0), cos(ax)] ] G.eye_R.localOrientation = [ [cos(az1), -sin(az1), 0], [cos(ax)*sin(az1), cos(ax)*cos(az1),-sin(ax)], [sin(ax)*sin(az1), sin(ax)*cos(az1), cos(ax)] ] eyes_done = True elif au == '26': # TODO: try with G.setChannel G.jaw['p26'] = SH_ACT_LEN * value # see always sensor in .blend elif au[0] == '9': # XXX: yes, 6 is a tongue prefix (do better ?) G.tongue[au] = SH_ACT_LEN * value else: cont.owner['p'+au] = value * SH_ACT_LEN cont.activate(cont.actuators[au]) INFO_PERIOD += time_diff if INFO_PERIOD > 5: print "--- RENDERING INFO ---" print "BGE logic running at", G.getLogicTicRate(), "fps." # print "BGE physics running at", G.getPhysicsTicRate(), "fps." print "BGE graphics currently at", G.getAverageFrameRate(), "fps." INFO_PERIOD = 0
def fps(self): """The current fps""" return gl.getAverageFrameRate()