Hotspots are areas in your world that automatically trigger events. An analogy in the real-world is motion detectors - the devices used to open doors, turn on lights, or signal alarms when you enter certain areas.
When you define a hotspot, you specify its location, shape, and size. A hotspot can be floating out in space, or it can be associated with a 3D object. You can also specify whether you want the hotspot to be triggered when the viewpoint leaves the specified area or when the viewpoint enters the specified area. Once a hotspot has been set off, it's de-activated. So, if you want to continue using a hotspot at that place, you'll need to create a new one.
To set up a hotspot, you need to both a) register the callback function that will handle hotspot events and b) start the hotspot.
Vizard has a hotspot callback in the Callback Wizard on the main toolbar or you can type it in yourself, using viz.callback(viz.HOTSPOT_EVENT, <hotspot function>) where <hotspot function> is the function that'll be called when a hotspot is triggered.
This function should be able to handle four parameters: the hotspot's id and the x,y, and z of the viewpoint's current position. Once you've registered this callback function, you can add as many hotspots as you want using viz.starthotspot(<hotspot id, shape and kind, and dimensions> ).
def onHotspot(id,x,y,z):
print
'you hit it'
viz.callback(viz.HOTSPOT_EVENT,onHotspot)
viz.starthotspot(1,
viz.RECTANGLE_HOTSPOT_IN, 0,3,.5,.5)
Hotspots can be either circular or rectangular. A hotspot can be triggered when you enter its area (an "IN" hotspot) or when you leave its area (an "OUT" hotspot). These two parameters make up the hotspot type in the viz.starthotspot command.
When you specify the position of a hotspot, you specify the x and z of the hotspot's center. The y dimension doesn't matter because hotspots continue indefinitely along the y axis. If you use <node3d>.starthotspot, you can attach a hotspot to a 3d node. This hotspot will be centered at the 3D node such that its x and z parameters will be applied relative to this center..
To set the dimensions of a circular hotspot, you need only set the radius. If you're using a rectangular hotspot, specify both its width (x) and its depth (z).
Use viz.deletehotspot(<hotspot id>) or <node3d>.deletehotspot(<hotspot id>) to get rid of a hotspot.
Moving and rotating a viewpoint
Viewpoint collision and gravity