Example - Button and animation

Button and animation example
Create an animated asset and a MeshInstance for the button in a scene.

In this example the object will be a set of rotating gears built as follows:

[pic] (Spatial with Skeleton, MeshInstance and AnimationPlayer)

Add a collidable MeshInstance so that ray emitted from the player's FPS camera can be used to interact with it.

Name the instances as follows:
 * Asset = Gears1

Add U_ in the name of the MeshInstance button's collide node, e.g U_col
 * MeshInstance = Button1

Add the following script to Button1: extends StaticBody var game func _ready: game = get_node( "/root/Game" ) func use( leftUse, rightUse): game.sendString( "Gears1", "boo" ) Add the following script to Gears: extends Spatial func receiveString( data ): get_node("AnimationPlayer").play ( "default", -1, 1, false ) get_node("AnimationPlayer").set_active(true)