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.
The property 'ShootPositionDisplacement' lets you specify the exact position from where the shot should come from. It is relative to the center of the mesh.
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 a sound Stops a specific sound, which has been started by 'Play a sound'.
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. You can access and change nearly all features of the 3D scene with this. See the JavaScript scripting reference for a list of all existing functions.
Since CopperCube 4.0.4, this works on all publishing targets.
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$". For showing the health of a game AI, use for example "Health: $#player1.health$", where 'player1' is the name of the object with the health. (See Special Variables for details).
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.
There are also special variables available, for quickly accessing data in the current scene. The names of these variables look like this: "#name.attribute". Use for example #player1.health for getting or changing the variable storing the health of the object with the game AI behavior of a scene node with the name 'player1'. See Special Variables for details.
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.
Restart a scene Restarts a scene, meaning it resets all objects, textures and behaviors as they were in the beginning of the scene. This is useful for example for creating levels for a game, which can be reused or replayed, like when the player dies or for another, new game run. Note that if you use this action, all actions below this action which manipulate objects in that scene will probably not have any effect since that scene will be reloaded.
Clone a scene node Creates a copy of an existing scene node. You can for example create an invisible enemy object, and use this as template to create multiple copies of it during the game, at random positions, in order to create enemies for the player dynamically. Another example: You can create copies of a precreated invisible particle system for showing impact explosions when a bullet hit a certain object or a wall.
This action gives the option to execute an action instantly on the created clone. You can use this for example to move the clone to a different position instantly. Use [The current scene node] as node for such actions then.

Note that if the original scene node has some references to itself in its actions and behaviors, then the references in the new actions and behaviors of the clone will be changed to reference the clone.
Delete a scene node Removes an object permanently from the scene.
Play or stop a video Plays a video, in 2D or 3D. See Video Playback for details.


Special Variables

There are a few special variables available, for quickly accessing data in the current scene, using one of the actions handling variables. The names of these variables look like this: "#name.attribute". Use for example #player1.health for getting or changing the variable storing the health of the object with the game AI behavior of a scene node with the name 'player1'.

Variable Name Description
health Health of an object with the behavior 'Game Actor with Health'. Use for example #player1.health for getting or changing the variable storing the health of the object with the game AI behavior of a scene node with the name 'player1'.
movementspeed The movement speed of an object with the behavior 'Game Actor with Health', 'Object or Person controlled by keyboard' or 'First Person Shooter Style Controlled'. Use for example #player1.movementspeed for getting or changing the variable storing the movementspeed of the object with such a behavior of a scene node with the name 'player1'.
damage The damage done by an object which somewhere uses a 'Shoot' action. Use for example #player1.damage for getting or changing the variable storing the damage of the the weapon of an object with the name 'player1'.
colsmalldistance The collision "small distance" used by a 'Collide When Moved' behavior. A very small value, set to 0.0005 for example. This affects how the ellipsoid is moved when colliding with a wall. Affects movement smoothness and friction. You can use this to adjust the collision behavior more in depth.
Note: If set to a too big or too small value, this will also may cause the ellipsoid to be stuck.
System Variables: The variables below this line are not part of a scene node, but always attached to an object named 'system'. Access them using #system.attribute, for example #system.soundvolume
soundvolume Use the system variable #system.soundvolume to change the global sound volume, of all sounds for the app. Has a value between 0 for quite to 100 for "full volume".

And if you need more actions, you can download more from the official website, or even create your own.