![]() |
|
|
|
#1
|
|||
|
|||
|
So right now I have to create a whole new sensor to get it to work, which is what I've done here. That is fine, but I don't know how to control it so that the first one will fade out as the new one comes in. With what I did below the first sphere automatically fades out, and the second sphere is always there. I only want one sphere to show up at a time.
However, If there is a way to keep one sensor and get it to move again and again when the marker and sensor touch each other that would be easier. #Create proximity manager manager = vizproximity.Manager() manager.setDebug(viz.ON) #proximity sensor-sphere sphereSensor = vizproximity.Sensor(vizproximity.Box([0.5,0.5,0.5],center=[0,0.1,0]),source=sphere) #Add main viewpoint as proximity target target = vizproximity.Target(marker2) #Add viewpoint target to manager manager.addTarget(target) #sphere movement 1 def ExitProximity(e): PointB = vizact.moveTo([0,1.5,1],speed=2) sphere.addAction(PointB) manager.onExit(sphereSensor,ExitProximity) #Fade Target 1 out fadeout = vizact.fadeTo(0,speed=1) vizact.onbuttondown('f',fadeout) sphere.addAction(fadeout) #Load Target 2 sphere2 = viz.add('ball.wrl') shape = sphere.collideBox() sphere2.setPosition([0,1.5,1]) viztask.waitActionEnd(sphere2,fadeout) #proximity sensor-sphere2 sphere2Sensor = vizproximity.Sensor(vizproximity.Box([0.5,0.5,0.5],center=[0,0.1,0]),source=sphere2) #Add sensors to manager (sphere) manager.addSensor(sphereSensor) manager.addSensor(sphere2Sensor) #Sphere movement 2 def ExitProximity2(e): PointC = vizact.moveTo([0,1.5,-2]) sphere2.addAction(PointC) manager.onExit(sphere2Sensor,ExitProximity2) |
|
#2
|
|||
|
|||
|
New Plan
So what if I make a new sensor every time, and have one fade out when you touch it. As it fades out, we want the new one to come in. Can anyone help me on how to have something fade in depending on the other one fading out?
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|