Stingray Forum (Read Only)
Welcome to Autodesk’s Stingray Forums. Share your knowledge, ask questions, and explore popular Stingray topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change active camera by keyboard

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Evan.Buxton
417 Views, 3 Replies

Change active camera by keyboard

I want to have a level with 6 cameras. Tapping 1-6 on the numpad of the physical keyboard will switch the active camera. Is this better with Flow or Lua?

3 REPLIES 3
Message 2 of 4
cgicollector
in reply to: Evan.Buxton

Watch this video, it might work.

 

https://www.youtube.com/watch?v=vHyoLSQ9jCk

Message 3 of 4
dave.tyner
in reply to: Evan.Buxton

If you're new to programming, Flow will be the more logical option and this functionality in particular is easy to set up as you can see in Paul's excellent video. 🙂

Message 4 of 4
Evan.Buxton
in reply to: dave.tyner

I was able to set this up quite easily - thanks for the help.

 

Connections = [
	{
		Class = "Stingray.Foundation.Flow.VariableConnection"
		FromItem = "Unit"
		FromNode = "9201e812-8e92-401d-b4a4-befde564dd0a"
		ToItem = "Unit"
		ToNode = "0bff9067-819b-4362-b579-afaeda088e0f"
		Type = "Unit"
	}
	{
		Class = "Stingray.Foundation.Flow.EventConnection"
		FromItem = "Pressed"
		FromNode = "d225f093-76dc-4ddb-962e-ffa8658952be"
		Priority = 0
		ToItem = "In"
		ToNode = "0bff9067-819b-4362-b579-afaeda088e0f"
	}
	{
		Class = "Stingray.Foundation.Flow.VariableConnection"
		FromItem = "Unit"
		FromNode = "c2918bcd-309f-4567-af20-2fe4854ad4ca"
		ToItem = "Unit"
		ToNode = "47007e6e-6925-496c-8b0d-fe1950437588"
		Type = "Unit"
	}
	{
		Class = "Stingray.Foundation.Flow.EventConnection"
		FromItem = "Pressed"
		FromNode = "10d7f0b3-f7ad-42d8-9f8a-0e8e3467473b"
		Priority = 0
		ToItem = "In"
		ToNode = "47007e6e-6925-496c-8b0d-fe1950437588"
	}
]
Groups = [
]
Nodes = [
	{
		Brief = "Allows the user to specify a standard keyboard button and send events such as pressed, held, and released."
		Category = "Input"
		Class = "Stingray.Foundation.Flow.DataDrivenFlowNode"
		ColorCategory = ""
		ExportTypeName = "keyboard_button"
		FlowNodesResourceKey = "flow_nodes_resource"
		Id = "d225f093-76dc-4ddb-962e-ffa8658952be"
		Inputs = [
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Input"
				Hidden = true
				RawName = "device"
				Type = "enum"
				UIName = "Device"
				Variable = {
					Class = "Stingray.Foundation.Flow.InEnumVariable"
					Value = "keyboard"
				}
			}
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Input"
				Hidden = true
				RawName = "device_number"
				Type = "float"
				UIName = "Device Number"
				Variable = {
					Class = "Stingray.Foundation.Flow.InVariableFloat"
					Value = 0
				}
			}
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Input"
				Hidden = false
				RawName = "button_name"
				Type = "enum"
				UIName = "Button Name"
				Variable = {
					Class = "Stingray.Foundation.Flow.InEnumVariable"
					Value = "1"
				}
			}
		]
		NodeLocation = {
			X = 320
			Y = -660
		}
		Outputs = [
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Output"
				RawName = "value"
				Type = "float"
				UIName = "Value"
				Variable = {
					Class = "Stingray.Foundation.Flow.OutVariableFloat"
				}
			}
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Output"
				RawName = "pressed"
				Type = "event"
				UIName = "Pressed"
				Variable = {
					Class = "Stingray.Foundation.Flow.OutEvent"
				}
			}
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Output"
				RawName = "released"
				Type = "event"
				UIName = "Released"
				Variable = {
					Class = "Stingray.Foundation.Flow.OutEvent"
				}
			}
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Output"
				RawName = "held"
				Type = "event"
				UIName = "Held"
				Variable = {
					Class = "Stingray.Foundation.Flow.OutEvent"
				}
			}
		]
		Title = "Keyboard Button"
		Width = 160
	}
	{
		Arguments = [
			{
				RawName = "Camera"
				Type = "camera"
				Variable = {
					Class = "Stingray.Foundation.Flow.InVariableCamera"
				}
			}
			{
				RawName = "Unit"
				Type = "unit"
				Variable = {
					Class = "Stingray.Foundation.Flow.InVariableUnit"
					UseMyUnit = false
				}
			}
		]
		Brief = "Sets the active camera for the engine."
		Category = "Camera"
		Class = "Stingray.Foundation.Flow.CustomScriptNode"
		FlowNodesResource = "core/appkit/appkit"
		FlowNodesResourceKey = "flow_nodes_resource"
		Id = "0bff9067-819b-4362-b579-afaeda088e0f"
		InEvents = [
			"In"
		]
		IsQuery = false
		Name = "Set Active Camera"
		NodeLocation = {
			X = 520
			Y = -720
		}
		OutEvents = [
			"Out"
		]
		ReturnValues = [
		]
		Width = 160
	}
	{
		Brief = "References a unit constant"
		Category = "Data"
		Class = "Stingray.Foundation.Flow.LevelUnit"
		Id = "9201e812-8e92-401d-b4a4-befde564dd0a"
		InEvents = [
		]
		InVariableNames = [
		]
		InVariables = [
		]
		NodeLocation = {
			X = 320
			Y = -740
		}
		OutEvents = [
		]
		OutVariableNames = [
		]
		OutVariables = [
		]
		SetUnit = {
			Id = "1a87dd89-6b0a-4fae-a85e-a6f35d5697d9"
		}
		Title = "Level Unit"
		Type = "core/units/camera"
		Unit = {
		}
		Width = 160
	}
	{
		Brief = "Allows the user to specify a standard keyboard button and send events such as pressed, held, and released."
		Category = "Input"
		Class = "Stingray.Foundation.Flow.DataDrivenFlowNode"
		ColorCategory = ""
		ExportTypeName = "keyboard_button"
		FlowNodesResourceKey = "flow_nodes_resource"
		Id = "10d7f0b3-f7ad-42d8-9f8a-0e8e3467473b"
		Inputs = [
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Input"
				Hidden = true
				RawName = "device"
				Type = "enum"
				UIName = "Device"
				Variable = {
					Class = "Stingray.Foundation.Flow.InEnumVariable"
					Value = "keyboard"
				}
			}
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Input"
				Hidden = true
				RawName = "device_number"
				Type = "float"
				UIName = "Device Number"
				Variable = {
					Class = "Stingray.Foundation.Flow.InVariableFloat"
					Value = 0
				}
			}
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Input"
				Hidden = false
				RawName = "button_name"
				Type = "enum"
				UIName = "Button Name"
				Variable = {
					Class = "Stingray.Foundation.Flow.InEnumVariable"
					Value = "2"
				}
			}
		]
		NodeLocation = {
			X = 320
			Y = -400
		}
		Outputs = [
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Output"
				RawName = "value"
				Type = "float"
				UIName = "Value"
				Variable = {
					Class = "Stingray.Foundation.Flow.OutVariableFloat"
				}
			}
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Output"
				RawName = "pressed"
				Type = "event"
				UIName = "Pressed"
				Variable = {
					Class = "Stingray.Foundation.Flow.OutEvent"
				}
			}
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Output"
				RawName = "released"
				Type = "event"
				UIName = "Released"
				Variable = {
					Class = "Stingray.Foundation.Flow.OutEvent"
				}
			}
			{
				Class = "Stingray.Foundation.Flow.DataDrivenFlowNode+Output"
				RawName = "held"
				Type = "event"
				UIName = "Held"
				Variable = {
					Class = "Stingray.Foundation.Flow.OutEvent"
				}
			}
		]
		Title = "Keyboard Button"
		Width = 160
	}
	{
		Arguments = [
			{
				RawName = "Camera"
				Type = "camera"
				Variable = {
					Class = "Stingray.Foundation.Flow.InVariableCamera"
				}
			}
			{
				RawName = "Unit"
				Type = "unit"
				Variable = {
					Class = "Stingray.Foundation.Flow.InVariableUnit"
					UseMyUnit = false
				}
			}
		]
		Brief = "Sets the active camera for the engine."
		Category = "Camera"
		Class = "Stingray.Foundation.Flow.CustomScriptNode"
		FlowNodesResource = "core/appkit/appkit"
		FlowNodesResourceKey = "flow_nodes_resource"
		Id = "47007e6e-6925-496c-8b0d-fe1950437588"
		InEvents = [
			"In"
		]
		IsQuery = false
		Name = "Set Active Camera"
		NodeLocation = {
			X = 520
			Y = -460
		}
		OutEvents = [
			"Out"
		]
		ReturnValues = [
		]
		Width = 160
	}
	{
		Brief = "References a unit constant"
		Category = "Data"
		Class = "Stingray.Foundation.Flow.LevelUnit"
		Id = "c2918bcd-309f-4567-af20-2fe4854ad4ca"
		InEvents = [
		]
		InVariableNames = [
		]
		InVariables = [
		]
		NodeLocation = {
			X = 320
			Y = -480
		}
		OutEvents = [
		]
		OutVariableNames = [
		]
		OutVariables = [
		]
		SetUnit = {
			Id = "a616938c-8b01-43b1-b5a1-0f5a02065d2f"
		}
		Title = "Level Unit"
		Type = "core/units/camera"
		Unit = {
		}
		Width = 160
	}
]

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report