View Single Post
  #3  
Old 03-14-2005, 02:03 AM
exhale exhale is offline
Member
 
Join Date: Feb 2005
Posts: 19
Hello,

thanks for your help, but i can't get it to trigger..
The text in the if statements isn't printed, so i guess it's never reached. I only changed the X, Z values of your script so it was surrounding my object. I'll post an excerpt of the code:

#hotspot IDs
ENTER = 0
LEAVE = 1

#Radius of hotspot
RADIUS = 5

#position of hotspot
HOTSPOT_X = 30
HOTSPOT_Z = 17.5

tbox = viz.add('tbox_paars.wrl')
tbox.translate(30,0,17.5)

tbox2 = viz.add('tbox_rood.wrl')
tbox2.translate(30,0,17.5)
tbox2.visible(viz.OFF)

def onhotspot(id,x,y,z):
if id == ENTER:
print 'Entered hotspot'
tbox.visible(viz.TOGGLE)
tbox2.visible(viz.TOGGLE)
#Create a hotspot that will be triggered when we leave the circle
viz.starthotspot(LEAVE,viz.CIRCLE_HOTSPOT_OUT,HOTS POT_X,HOTSPOT_Z,RADIUS)

elif id == LEAVE:
print 'Leaving hotspot'
tbox.visible(viz.TOGGLE)
tbox2.visible(viz.TOGGLE)
#Create a hotspot that will be triggered when we enter the circle
viz.starthotspot(ENTER,viz.CIRCLE_HOTSPOT_IN,HOTSP OT_X,HOTSPOT_Z,RADIUS)

#hotspot -> onhotspot
viz.callback(viz.HOTSPOT_EVENT,onhotspot)
#Create a hotspot that will be triggered when we enter the circle
viz.starthotspot(ENTER,viz.CIRCLE_HOTSPOT_IN,HOTSP OT_X,HOTSPOT_Z,RADIUS)

ps: Code is indented correctly in the editor

any ideas why this isn't working?

EDIT: i also tried leaving out the if statements and doing the visible toggling straight away, which didn't work either. The method is never entered. I also tried with a rectangle, put collision on or off, which didn't give me any success..

greets and thanks in advance!

Kevin

Last edited by exhale; 03-14-2005 at 02:17 AM.
Reply With Quote