Back to Content

Actions Overview


CopperCube includes several actions which can be triggered by behaviors and other actions. With these it is not only possible to animate the 3d objects but also to add interactivity to your 3d application: Reacting to key and button presses, playing sounds or even creating ingame AI controlled characters.
The behaviors can be accessed in the property window of every object in the scene, on the tab 'behaviors':

 

To create an action, choose for example the behavior 'when clicked do something', and then click the '...' button in it's property 'Action'.
A window will pop up where you can create a new action, to specify what should happen. The following is a list with short descriptions of all types of actions available:


Name Description
Hide or Unhide a Scene node Makes a 3D scene node visible or invisible.
Change Position of a Scene node Lets a 3D scene node change its position. Based on the settings set, it is possible to set it to a new fixed 3d position or relative to another position. Also, it is possible to do this animated, over a short amount of time.
Change Rotation of a Scene node Lets a 3D scene node change its rotation. Based on the settings set, it is possible to set it to a new fixed 3d rotation or rotate it a bit relative to the current rotation.
Change Scale of a Scene node Lets a 3D scene node change its scale. Based on the settings set, it is possible to set it to a new fixed 3d scale or scale it a bit relative to the current scale.
Change a texture This action makes it possible to set a new texture to a scene node.
Set animation of animated scene node Makes it possible to change the current animation of an animated scene node to a new one. When you have a skeletal animated 3d mesh in your scene, you can spefify these animations in the animation editor.
Shoot This action is usually used together with the 'game AI' behavior. It shoots an object at another object. It is possible to specify a 3d object to be used as 'bullet' for this shot, or to use no bullet at all.
Additionally, it is possible to specify a node from where it should be shot. Usually, this can be left to [Current camera or AI] and should work propertly. But when spefifying a speficic node where the action should shoot from, there are two modes: Shoot into the look direction of that node (plus an optional additional rotation) or shoot to where the active camera is pointing at, from that node. This is useful for creating 3rd person shooters.
Change active Camera Sets a new active camera to render this scene from.
Set Camera Target Changes the camera target position, where the camera is pointing at. Based on the settings set, it is possible to set it to a new fixed 3d position or relative to another position. Also, it is possible to do this animated, over a short amount of time.
Switch to another scene Sets a scene to the new active scene.
Play a sound Plays a sound, in 2d or 3d. When Playing in 3d, a 3d position can be specified, either at a fixed 3d position or relative to another position.
Stop all sounds Stops all currently playing sounds.
Open a website Opens a website in a browser. Note that for the 'URL' parameter, it is necessary to start it with http://, otherwise it won't work.
Execute JavaScript Specifies some javascript code to be executed. Try it for example with "alert('hallo');", which will pop up a message box and show the text "hallo". (Note: When publising as Mac OS X .app or Windows .exe, use "print('hallo')" instead, the command alert isn't available there).
Change 2D Overlay Text Sets the text of a 2D overlay to a new text. It is also possible to print the content of variables with this, if wanted, by inserting the variable name surrounded by the '$' symbol. For example to display the text of a variable named 'score' after some text in the 2D overlay, set the text to "Your score: $score$".
Quit Application Quits the application. Obviously only works when publishing as Windows or Mac OS X application.
Set or change a Variable Sets or change the value of a global variable. Variables can be used to bring more interactivity to your application. They can be set to numbers and texts, influence how your application works by for example the 'If variable has a value do something' action, or be printed to the screen using the 'Change 2D Overlay Text'.
The parameters for this action are:
  • VariableName: Set it to a name of your variable, for example 'score'.
  • Operation: Specifies what to do with that variable. Operations 'Set to a value', 'Add a value', 'Substract a value', 'Divide' and 'Multiply' are available.
  • ValueType: Can be set to either 'Value' or 'Variable'. If set to 'Value', the text entered in the 'Value' attribute below should be a value, such as 1. That number will be then used to change your variable. If set to 'Variable', the text in the field 'Value should be set to the name of another variable, which then will be used to change your variable.
If a variable has a value do something Executes another action if a variable has a certain value. There are the operators 'Equals', 'Equals not', 'Is bigger than' and 'Is lower than' available. The entry 'ValueType' can be set to either 'Value' or 'Variable'. If set to 'Value', the text entered in the 'Value' attribute below should be a value, such as 1. That number will be then used to compare your variable. If set to 'Variable', the text in the field 'Value should be set to the name of another variable, which then will be used to compare your variable with. The 'Action' field will be executed only if the comparison is true then.
Restart behaviors of a scene node Restarts the behaviors of a scene node. Can for example be used to restart the texture animation of a scene node. Works only with certain behaviors, such as the "Animate a texture" behavior.
Load or Store a Variable Saves or Loads the content of a variable to or from disk. In this way, it is possible to create simple 'savegames' for CopperCube Applications. This works for all targets, and uses the registry (Windows .exe), the local settings directory (Mac OS X), flash cookies (Flash) or HTML cookeis (WebGL). Note: Some browsers like Google's Chrome don't support storing cookies when running HTML pages from local disk. You need to run your WebGL app from a local webserver to test this feature out then.