Example - Light and light switch

Light and light switch example
Create a OmniLight and a MeshInstance  for the light switch in a scene.

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:
 * OmniLight = OmniLight1

Add U_ in the name of the MeshInstance collide node, e.g U_col
 * MeshInstance = LightSwitch1

Add the following script to LightSwitch1: extends StaticBody var game func _ready: game = get_node( "/root/Game" ) func use( leftUse, rightUse): var light = get_node( "/root/Main/OmniLight1" ) if( light.is_enabled ): game.sendString( "OmniLight1", "Off" ) else: game.sendString( "OmniLight1", "On" ) Add the following script to OmniLight1: extends OmniLight var game func _ready: game = get_node( "/root/Game" ) game.initString( "OmniLight1", "On") func receiveString( data ): if( data=="Off" ): set_enabled( false ) else: set_enabled( true ) func initString( data ): if( data=="Off" ): set_enabled( false ) else: set_enabled( true )