Vizard 8 » Command Index » Vizard objects » animationpath » <animationpath>.addEventAtDistance
8.0

<animationpath>.addEventAtDistance

Trigger event when distance is reached

<animationpath>.addEventAtDistance(  
name  
distance  
)  
name
Name of the event. This can be any string which will be assigned to the name attribute of the viz.PATH_EVENT event object.
distance
The distance from the start of the path.

Remarks

This command will add an event to the path which will be triggered when the path reaches the specified distance from the start. The distance should be between 0 and <animationpath>.getDistance. The event will be triggered on every loop.

A viz.PATH_EVENT will be triggered with the specified event name and animation path.

Return Value

None

Example

# Create event when meter 2 is reached
path.addEventAtDistance('meter_2', 2.0)

# Register callback when path is 2 meters from start
def onSecondMeter():
    print('2 meters from start')
vizact.onPathEvent(path, 'meter_2', onSecondMeter)

See also

<animationpath>.addEventAtControlPoint
<animationpath>.addEventAtEnd
<animationpath>.addEventAtTime
<animationpath>.clearEvents
<animationpath>.removeEvent
<vizact>.onPathEvent
<viztask>.waitPathEvent
viz.PATH_EVENT