def keyfunc2( key, mx, my, tm ): if chr(27) == key: print _pylon.exit( 0 ) global sim2Outset global sim2 if key == ',': #pylon.wait_sec_f(10.0/25.0) #sim2.stop() rnum = 3 sim2Outset = None print "'simulation2' = ",pylon.sim_num_objects( "simulation2" ) #while pylon.sim_num_objects( "simulation2" ) > 0: #print "'simulation2' = ",pylon.sim_num_objects( "simulation2" ) #pylon.wait_sec_f(0.1) sim2Outset = sim2.newObject("sim2Outset_"+str(tm)) sim2Outset.setOptions( pylon.solid_stationary | pylon.solid_concave | pylon.solid_sphere ) #sim2Outset.setProperties( pylon.object_draw_children ) #sim2Outset.setProperties( pylon.object_debug ) sim2Outset.setProperties( 0 ) pylon.object_add_sphere( sim2Outset.simname, sim2Outset.name, 1.5, 20, 20, possibleImages[rnum], 1, 1, possibleTriProps[rnum]|pylon.triangle_invert_normals ) sim2Outset.setVisibility(pylon.key_ispressed('v')) #sim2Outset.setInvisible() #sim2Outset.setVisible() sim2Outset.build() #sim2.resume() if key == 'v': sim2Outset.setInvisible()
def keyfunc3( key, mx, my, tm ): global sim2Outset if key == 'l': if pylon.sim_remove_object( sim2Outset.simname, sim2Outset.name ): print " AKHBSDjkHAKJJSD" rnum = 3 sim2Outset = None while sim2Outset == None: sim2Outset = sim2.newObject("sim2Outset_"+str(tm)) sim2Outset.setOptions( pylon.solid_stationary | pylon.solid_concave | pylon.solid_sphere ) sim2Outset.setProperties( 0 ) pylon.object_add_sphere( sim2Outset.simname, sim2Outset.name, 1.5, 20, 20, possibleImages[rnum], 1, 1, possibleTriProps[rnum]|pylon.triangle_invert_normals ) sim2Outset.setVisibility(pylon.key_ispressed('v')) sim2Outset.build()
def getstrthing(st): global lastkey global lastkeycount if pylon.key_ispressed(pylon.key_last()) and (not lastkey == pylon.key_last() or (lastkey == pylon.key_last() and lastkeycount > 5)): st = st + str(pylon.key_last()) if not lastkey == pylon.key_last(): lastkeycount = 0 lastkey = pylon.key_last() #a = 0 #while a < 500: #a = a + 1 if lastkey == pylon.key_last(): lastkeycount = lastkeycount + 1 return st
def hitfilter1( sim, obj1, obj2 ): #print "hitfilter1( ",sim,", ",obj1,", ",obj2," )" if pylon.key_ispressed( '=' ) or obj2.find("sim2Outset") != -1: return True return False