PDA

View Full Version : Phase Space and Proximity Sensors


snovob93
06-07-2012, 09:40 AM
Hello,

I'm a student at West Virginia University and working on a project for the summer that involves Phase Space. We want to have an LED sensor on the finger to reach for a 3D virtual target and move to a new location. I was able to connect to Phase Space and link the LED to a marker so it shows up on screen. I was also able to place proximity sensors around a virtual target so that when the LED touches it, it moves to its next location. Its in there as an exitproximity function.
So what we want is that every time the subject reaches for the target it moves to a new location and they have to reach for it again. The issue I'm having is that after the initial reach and move I can't get it to do it again. I mean I could copy and paste a new proximity sensor for each movement, but I have a feeling there could be an easier way. Any ideas at all to speed up the process up would be appreciated!

farshizzo
06-11-2012, 06:01 PM
Can you post the relevant section of code you are using in your script to handle the proximity sensors?

snovob93
06-12-2012, 09:09 AM
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)

snovob93
06-13-2012, 01:32 PM
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?