![]() |
#1
|
|||
|
|||
TypeError: Could not convert list item to float
Hi All,
I have created a virtual environment whereby a photographic car approaches the observer viewpoint and the degree of expansion of the object on approach is manipulated according to a Psychophysical procedure. I am now trying to insert some distracter motion and have so far been successful in inserting some pedestrians on the sidewalks. I have created some other cars by inserting quads and wrapping a car image around them. However, after inserting the necessary commands into the procedure - I get the error message "TypeError: Could not convert list item to float". I understand that there is a lot of code in my script, so I have included only the parts where the error and where I created the object "vehicledummy2" is occuring for now... ## Create Dummy Car Left Facing Side ## dummy2carsize = [3.2, 1.65] # [ height, width ] cardummyleft = viz.addTexture('Van Right Facing.tif') vehicledummy2 = viz.addTexQuad(viz.WORLD,viz.MainScene,1) # 1m sq quad vehicledummy2.texture(cardummyleft) vehicledummy2.setScale(dummy2carsize[0],dummy2carsize[1],1) # Size to car width & height vehicledummy2.setEuler(90,0,0) vehicledummy2.setPosition(outofview) vehicledummy2.appearance(viz.TEXMODULATE)# ----------------------------------------------# # MOVE THE OBJECT FOR THE SPEC'D TIME # # ----------------------------------------------# def render_ball1(on_switch, Loom_level): global select,rng,plgit, mlgit,prob, nv, trialsplt,nv_p,sgn,sgn_p,reverse, X_motion,Obs_rotn, L_inc,Min_loom,Obj_sz,Obj_scale, T_exp, Z_dist,Z_far, Speed global Vert_screen, Aspect, Z_observer, pixelcm, pixeldg,Lpixels,selectM, remove object1.setPosition(xobs,yobs,Z_dist) theta_start = math.atan(Obj_sz/Z_dist) theta_final = theta_start + Loom_level*T_exp Rescale = theta_final/theta_start # zero shift if not a descent trial if on_switch == 0: Rescale = 1.0 Size_shift = vizact.size(Rescale*Obj_scale[0],Rescale*Obj_scale[1],1,T_exp,viz.TIME) # Calculate random side motion. side = [-0.5, 0.5, -1, 1] updn = [-0.5, 0.5, -1, 1] random.shuffle(side); random.shuffle(updn); X_shift = X_motion[select]*side[0] # Use observer rotn instead Y_shift = Y_motion[select]*updn[0] # Use observer rotn instead #Pos_shift=vizact.goto(0*X_shift,0*Y_shift,Z_dist, T_exp,viz.TIME) #print X_shift,Y_shift,Z_dist #motion = vizact.parallel(Size_shift,Pos_shift) cross1.visible(viz.OFF) time1=viz.tick() object1.visible(viz.ON) time2=viz.tick() male = viz.add('vcc_male.cfg') male.setPosition(xobs+3, 0, Z_observer+25) male.setEuler(0,0,0) male.state(2) m_walk = vizact.goto(xobs+3, 0, Z_observer+26, 0.25, viz.TIME) m_walking_sequence = vizact.sequence(m_walk, remove) male.addAction(m_walking_sequence) female = viz.add('vcc_female.cfg') female.setEuler(180,0,0) female.state(2) female.setPosition(xobs+4, 0, Z_observer+28) f_walk = vizact.goto(xobs+4, 0, Z_observer+27, 0.25, viz.TIME) f_walking_sequence = vizact.sequence(f_walk, remove) female.addAction(f_walking_sequence) female2 = viz.add('vcc_female.cfg') female2.setEuler(180,0,0) female2.state(1) female2.setPosition(xobs-15, 0, Z_observer+80) f_walk2 = vizact.goto(xobs-15, 0, Z_observer+80, 0.25, viz.TIME) f_walking_sequence2 = vizact.sequence(f_walk2, remove) female2.addAction(f_walking_sequence2) #Add the models vehicledummy2set = vizact.goto(xobs-1, 0, Z_observer+10) vehicledummy2move = vizact.goto(xobs-1, 0, Z_observer+10, 0.25, viz.TIME) vehicledummy2sequence = vizact.goto(vehicledummy2set, vehicledummy2move, remove) vehicledummy2.addAction(vehicledummy2sequence) # if selectM == 0: view.goto(xobs,yobs,Z_observer,T_exp,viz.TIME) # if selectM == 1: # view.spinto(side[0],updn[0],0,Obs_rotn,T_exp,viz.TIME) time3=viz.tick() object1.add(Size_shift) time4=viz.tick() # print time1,time2,time3,time4 Obviously a number of these variables have been defined earlier in the script - can anyone shed any light on why this error message might be surfacing? Thanks |
Thread Tools | |
Display Modes | Rate This Thread |
|
|