#1
|
|||
|
|||
problem in updating text
Hi,
I have given my code below. In my program when i press 'w', the avatar walks to the position (0,0,5) and collides with box and prints the text 'santhosh'. When i press 'c' the avatar proceeds to the next position (0,0,15) and collides with box1 and prints the text 'sujith'. but the problem is tat the first text 'santhosh' still remains. I want it to vanish wen the avatar collides with the second box. Pls help me. I am doing a project. Pls help me. Thanks a lot code: import viz import vizact viz.phys.enable() viz.setMultiSample(4) viz.fov(60) viz.go() male = viz.addAvatar('vcc_male.cfg') male.scale(3,3,3) ground = viz.add('tut_ground.wrl') ground.collidePlane() env=viz.add(viz.ENVIRONMENT_MAP,'sky.jpg') dome = viz.add('skydome.dlc') dome.texture(env) box = viz.add('box.wrl',scale=[2,2,2],pos=(0,0,5),color = viz.BLUE) box.collideBox() box.disable(viz.DYNAMICS) box1 = viz.add('box.wrl',scale=[1.5,1.5,1.5],pos=(0,0,15),color = viz.RED) box1.collideBox() box1.disable(viz.DYNAMICS) box2 = viz.add('box.wrl',scale=[1.5,1.5,1.5],pos=(-10,0,0),color = viz.RED) box2.collideBox() box2.disable(viz.DYNAMICS) box3 = viz.add('box.wrl',scale=[1.5,1.5,1.5],pos=(-20,0,0),color = viz.RED) box3.collideBox() box3.disable(viz.DYNAMICS) #textScreen = viz.addText('Press a',parent=viz.ORTHO,pos=[400,500,0],fontSize=50) rHandBox = viz.add('box.wrl',scale=[1,1,1]) rHandBox.collideBox() rHandBox.disable(viz.DYNAMICS) rHandBox.enable(viz.COLLIDE_NOTIFY) rHandLink = viz.link( male.getBone('Bip01 R Foot') , rHandBox ) #tweak the position of the box to cover the hand rHandLink.preTrans([0.05,-0.5,0]) def onCollideBegin(g): textScreen = viz.addText('Press a',parent=viz.ORTHO,pos=[400,500,0],fontSize=50) textScreen.visible(viz.OFF) if g.obj1 == rHandBox: if g.obj2 == box: box.color(viz.RED) textScreen.message('santhosh') textScreen.visible(viz.ON) #textScreen.visible(viz.OFF) #new=textScreen.message('somethin new') #textScreen = viz.addText('Press a',parent=viz.ORTHO,pos=[400,500,0],fontSize=50) #fun=textScreen.removeParent(textScreen) #viz.callback(viz.COLLIDE_END_EVENT,onCollideBegin ) if g.obj1 == rHandBox: if g.obj2 == box1: box1.color(viz.BLUE) #textScreen.visible(viz.OFF) textScreen.message('sujith') textScreen.visible(viz.ON) #textScreen1 = viz.addText('Press x',parent=viz.ORTHO,pos=[400,500,0],fontSize=50) if g.obj1 == rHandBox: if g.obj2 == box2: box2.color(viz.BLUE) textScreen = viz.addText('Press c',parent=viz.ORTHO,pos=[100,0,0],fontSize=50) if g.obj1 == rHandBox: if g.obj2 == box3: box3.color(viz.BLUE) textScreen = viz.addText('Press r',parent=viz.ORTHO,pos=[400,200,0],fontSize=50) viz.callback(viz.COLLIDE_BEGIN_EVENT,onCollideBegi n) def wukavatar(): walk1 = vizact.walkTo([0,0,5]) male.addAction(walk1) vizact.onkeydown('w',wukavatar) def wakavatar(): walk2 = vizact.walkTo([0,0,15]) male.addAction(walk2) vizact.onkeydown('c',wakavatar) |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
input from a text file | dig | Vizard | 5 | 10-20-2013 01:20 AM |
Use saved text file data as replay sources problem | mizutani_jun | Vizard | 4 | 10-14-2010 04:49 PM |
Informationboxes with text | snoopy78 | Vizard | 3 | 07-16-2009 10:23 AM |
Vizard tech tip: Text to Speech | Jeff | Vizard | 1 | 01-15-2009 09:39 PM |
viz.lookat() with 3d text problem | shivanangel | Vizard | 2 | 04-30-2007 02:34 PM |