====== vci.me.GetAxisInput() (Key input) ====== \\ Receive keyboard input with VCI.\\ ---- ===== List of keys ===== ^ VCI control key ^ Default key bind ^ Script ^ Available value ^ | Forward | Up Arrow | vci.me.GetAxisInput().z | Z = +1 | | Backward | Down Arrow | vci.me.GetAxisInput().z | Z = -1 | | Left | Left Arrow | vci.me.GetAxisInput().x | X = -1 | | Right | Right Arrow | vci.me.GetAxisInput().x | X = +1 | | Up | U | vci.me.GetAxisInput().y | Y = +1 | | Down | I | vci.me.GetAxisInput().y | Y = -1 | | Key1 | 1 (Numeral 1) | vci.me.GetButtonInput(1) | true,false | | Key2 | 2 (Numeral 2) | vci.me.GetButtonInput(2) | true,false | | Key3 | 3 (Numeral 3) | vci.me.GetButtonInput(3) | true,false | | Key4 | 4 (Numeral 4) | vci.me.GetButtonInput(4) | true,false | ==== Summary of key input ==== * 10 keys are available as shown above. * Key binds can be changed in [[en:virtualcast:setting:control|Settings (Control)]] in VirtualCast. * The client must be active* to receive key inputs.\\ * VirtualCast becomes active when the application window is clicked with the mouse cursor. * GetAxisInput() allows you to get the key inputs converted into XYZ axis format as Vector3 value.\\ The value can be -1, 0 or 1. (Not an analog value of -1~1) * GetAxisInput() has value while a key is being pressed. When nothing is pressed, it has a value of 0. * Key inputs can only be received on the client which is running the VCI script.\\ (When the Input is written under "if Is.Mine then", the key input will be enabled on the client which spawned the VCI.) ---- ===== GetButtonInput() ===== **Argument: number** **Return value: bool**\\ Returns true when the button corresponding to the argument is being pressed. If not, false is returned.\\ -- Show a message on console when Key1 is pressed if vci.me.GetButtonInput(1) then print(" Button1 pushed") end ---- ===== GetAxisInput() ===== **return value: Vector3**\\ Returns Vector3 that represents the state when the corresponding key is pressed for Forward, Backward, Left, Right, Up and Down.\\ When not pressed, the value is 0. When pressed, the value is either -1 or 1.\\ -- The state of key is stored in the axis as Vector3 local axis = vci.me.GetAxisInput() -- Show on console print(" axis : "..tostring(axis)) ---- ===== Example script ===== function update() -- Get the axis input. local axis = vci.me.GetAxisInput() if axis.x ~= 0 then print(" X : "..tostring(axis.x)) end if axis.y ~= 0 then print(" Y : "..tostring(axis.y)) end if axis.z ~= 0 then print(" Z : "..tostring(axis.z)) end if vci.me.GetButtonInput(1) then print(" Button1 pushed") end if vci.me.GetButtonInput(2) then print(" Button2 pushed") end if vci.me.GetButtonInput(3) then print(" Button3 pushed") end if vci.me.GetButtonInput(4) then print(" Button4 pushed") end end An example that displays the result of each key being pushed on the console.\\ ---- ===== Example VCI ===== * [[en:vci:sample:input:sample1 | Create a VCI that moves/scales/rotates with keyboard input]] \\