Adam
04-08-2005, 11:19 AM
Hi All,
I was wondering if it was possible to have nested hotspots? (as the title of the thread indicates)
My plan was to create a zone of safe travel in the lab that would monitor a users position, and give them a warning when they exit the safe zone (which would be specified by a rectangle hotspot out).
Additionally, I wanted to make use of a circular hotspot, within that safe zone of travel. Is this possible?
I have had no luck as of yet getting both to work in conjunction. I realize I could achieve the same effect with if statements inside a timer that checks current position against the boundaries of the safe zone, but this is not a very elegant solution.
I really just need to get this to work however, and will resort to any means necessary to carry off the desired effect.
The code I have tried so far is as follows: (pardon the formatting)
import viz
viz.go()
SAFE = 1
UNSAFE = 2
TARGET = 3
viz.clearcolor(1,1,1)
def handlemyhotspots(id,x,y,z):
if id == SAFE:
print 'inside safe zone'
viz.clearcolor(1,1,1)
viz.starthotspot(UNSAFE,viz.RECTANGLE_HOTSPOT_OUT, 0,3,2.4,6)
elif id == UNSAFE:
print 'outside safe zone'
viz.clearcolor(0,0,0)
viz.starthotspot(SAFE,viz.RECTANGLE_HOTSPOT_IN,0,3 ,2.4,6)
elif id == TARGET:
print 'at target'
viz.callback(viz.HOTSPOT_EVENT, handlemyhotspots)
viz.starthotspot(UNSAFE,viz.RECTANGLE_HOTSPOT_OUT, 0,3,2.4,6)
viz.starthotspot(TARGET,viz.CIRCLE_HOTSPOT_IN,0,3, .5)
I would appreciate any assistance you can provide with regard to my question.
Adam
I was wondering if it was possible to have nested hotspots? (as the title of the thread indicates)
My plan was to create a zone of safe travel in the lab that would monitor a users position, and give them a warning when they exit the safe zone (which would be specified by a rectangle hotspot out).
Additionally, I wanted to make use of a circular hotspot, within that safe zone of travel. Is this possible?
I have had no luck as of yet getting both to work in conjunction. I realize I could achieve the same effect with if statements inside a timer that checks current position against the boundaries of the safe zone, but this is not a very elegant solution.
I really just need to get this to work however, and will resort to any means necessary to carry off the desired effect.
The code I have tried so far is as follows: (pardon the formatting)
import viz
viz.go()
SAFE = 1
UNSAFE = 2
TARGET = 3
viz.clearcolor(1,1,1)
def handlemyhotspots(id,x,y,z):
if id == SAFE:
print 'inside safe zone'
viz.clearcolor(1,1,1)
viz.starthotspot(UNSAFE,viz.RECTANGLE_HOTSPOT_OUT, 0,3,2.4,6)
elif id == UNSAFE:
print 'outside safe zone'
viz.clearcolor(0,0,0)
viz.starthotspot(SAFE,viz.RECTANGLE_HOTSPOT_IN,0,3 ,2.4,6)
elif id == TARGET:
print 'at target'
viz.callback(viz.HOTSPOT_EVENT, handlemyhotspots)
viz.starthotspot(UNSAFE,viz.RECTANGLE_HOTSPOT_OUT, 0,3,2.4,6)
viz.starthotspot(TARGET,viz.CIRCLE_HOTSPOT_IN,0,3, .5)
I would appreciate any assistance you can provide with regard to my question.
Adam