![]() |
#1
|
|||
|
|||
sensor radius bug?
Hey there!
I am using the circleArea proximity sensor so one can "collect" objects. I want the difference between the radius of the object and the radius of the sensor to be constant. Therefore I pass the radius of the object plus my constant value to the circleArea sensor and then link the sensor to the object. Before you start the programm you can change the transformation of the object that will be "collected". Now here is my Problem: When I scale the object the sensor is much bigger (or smaller) as it should be. I think its because I linked the sensor and the object. But I need the link so I can easily let the object disappear, when someone "collects" it. To show my problem I wrote an example, where I just pass a constant to the sensor and it still gets much bigger as the one of the non-scaled object: Code:
import viz import vizshape import vizproximity viz.setMultiSample(4) viz.fov(60) viz.go() viz.MainView.setPosition(0,5,-4) viz.MainView.setEuler(0,45,0) manager = vizproximity.Manager() #to see the circleArea manager.setDebug(viz.ON) purpleCylinder = vizshape.addCylinder(height=2.0,radius=0.3,topRadius=None,bottomRadius=None,yAlign=vizshape.ALIGN_MIN,slices=20,bottom=True,top=True) purpleCylinder.color(viz.PURPLE) purpleCylinder.setPosition(-2.5,0,0) #non-scaled purple cylinder purpleSensor = vizproximity.CircleArea(radius=0.7) #link sensor to the object linkedPurpleSensor = vizproximity.Sensor(purpleSensor, purpleCylinder) manager.addSensor(linkedPurpleSensor) print 'purple: ', linkedPurpleSensor redCylinder = vizshape.addCylinder(height=2.0,radius=0.3,topRadius=None,bottomRadius=None,yAlign=vizshape.ALIGN_MIN,slices=20,bottom=True,top=True) redCylinder.color(viz.RED) redCylinder.setPosition(1,0,0) #scale the second red cylinder up redCylinder.setScale(4,4,4) redSensor = vizproximity.CircleArea(radius=0.7) #link sensor to the object linkedRedSensor = vizproximity.Sensor(redSensor, redCylinder) manager.addSensor(linkedRedSensor) print 'red: ', linkedRedSensor purple: Sensor(shape=CircleArea(radius=0.7, center=(0.0, 0.0)), source=NodeSource(node=viz.VizPrimitive(2), flag=4, name='')) red: Sensor(shape=CircleArea(radius=0.7, center=(0.0, 0.0)), source=NodeSource(node=viz.VizPrimitive(4), flag=4, name='')) Can someone tell me what happened? Am I doing something wrong or is it a bug? |
Thread Tools | |
Display Modes | Rate This Thread |
|
|