Reference: Flow control

Node commands as actions

The vizact library also contains many single command actions. These actions are simply standard node3d commands which can be treated as actions. To create a single command action, simply add the node3d command after vizact.method. For instance, <node3d>.texture would become vizact.method.texture, <node3d>.visible would become vizact.method.visible, and so on. The arguments to these actions are exactly the same as the arguments to the regular commands.

 

Let's say you wanted to create an action that would toggle the visibility of an object every time the spacebar is pressed. You would simply create an action to wait for the space key and an action to toggle the visibility of a node, then you would add these actions to an action sequence which repeats forever:

 

ToggleVisible = vizact.sequence( [vizact.waitkey(' '), vizact.method.visible(viz.TOGGLE)], viz.FOREVER)
node.addAction(ToggleVisible)

See also

In this section:

Action Basics

Action synchronization and management

Sequences

Dynamic parameters

Creating your own actions

Actions command table

Other sections:

Tutorial: Using actions

Task basics

Director basics

Timer basics

Animation path basics

Event Basics

Example scripts:

Actions

Event callbacks