m |
m |
||
Line 47: | Line 47: | ||
{{ScriptFunction|float|MouseX|{ get; }|Returns a float representing the Mouse/Right Joystick horizontal movement. If the value is positive the movement is upwards. If the value is negative the movement is downwards. The value is derived by multiplying mouse delta with axis sensitivity. This is frame-rate independent; you do not need to be concerned about varying frame-rates when using this value. |5=<pre>MouseX = Space.Input.MouseX</pre> | {{ScriptFunction|float|MouseX|{ get; }|Returns a float representing the Mouse/Right Joystick horizontal movement. If the value is positive the movement is upwards. If the value is negative the movement is downwards. The value is derived by multiplying mouse delta with axis sensitivity. This is frame-rate independent; you do not need to be concerned about varying frame-rates when using this value. |5=<pre>MouseX = Space.Input.MouseX</pre> | ||
− | + | ---- | |
+ | <pre> | ||
--this script will rotate this object along the Y axis | --this script will rotate this object along the Y axis | ||
--according to your mouse/right joystick horizontal movement | --according to your mouse/right joystick horizontal movement |
The SInput class returns the current state of input devices connected to the players device.
To ensure a cross-platform experience that works with Game Pads, Keyboards, Mouse and Mobile devices - as well as foreign language keyboards, we do not allow you to listen for specific keyboard keys, instead you may listen to predefined key groups which are consistent across devices. These can be used where ever a function argument is named 'key'.
Keys
Returns true if 'key' was pressed during this frame.
Returns true if 'key' is being held pressed.
Returns true if 'key' is no longer pressed during this frame (but was in the last).
Returns true if mouse 'button' was pressed during this frame.
if Space.Input.GetMouseDown(1) then Space.Log("Right Mouse button pressed in this frame") end
Returns true if mouse 'button' is being held pressed.
if Space.Input.GetMouseHold(1) then Space.Log("Right Mouse button being held") end
Returns true if mouse 'button' is no longer pressed during this frame (but was in the last).
if Space.Input.GetMouseUp(1) then Space.Log("Right Mouse button was just unpressed") end
No documentation
Space.Input.Vibrate(1,1,false)
Returns a non-0 value if the mouse wheel is being scrolled, value usually ranges from -1 to 1
if Space.Input.ScrollWheel> 0 then Space.Log("mouse wheel is being scrolled up") end
Returns the current position of the mouse in screen pixels. If on a touch screen device, this will also return the location of the first finger being pressed.
currentMousePos = Space.Input.MousePosition
Returns a float representing the Mouse/Right Joystick horizontal movement. If the value is positive the movement is upwards. If the value is negative the movement is downwards. The value is derived by multiplying mouse delta with axis sensitivity. This is frame-rate independent; you do not need to be concerned about varying frame-rates when using this value.
MouseX = Space.Input.MouseX
--this script will rotate this object along the Y axis --according to your mouse/right joystick horizontal movement thisGameObject = Space.Host.ExecutingObject function OnUpdate() currentY = thisGameObject.WorldRotation.EulerAngles.Y newY = currentY + Space.Input.MouseX thisGameObject.WorldRotation = Quaternion.Euler(0, newY, 0) end thisGameObject.SubscribeToEvents() thisGameObject.OnUpdate(OnUpdate)
Returns a float representing the Mouse/Right Joystick vertical movement. If the value is positive the movement is to the right. If the value is negative the movement is to the left. The value is derived by multiplying mouse delta with axis sensitivity. This is frame-rate independent; you do not need to be concerned about varying frame-rates when using this value.
MouseX = Space.Input.MouseX
--------------------------------- --this script will rotate this object along the Y axis --according to your mouse/right joystick vertical movement thisGameObject = Space.Host.ExecutingObject function OnUpdate() currentX = thisGameObject.WorldRotation.EulerAngles.X newX = currentY + Space.Input.MouseY thisGameObject.WorldRotation = Quaternion.Euler(newX , 0, 0) end thisGameObject.SubscribeToEvents() thisGameObject.OnUpdate(OnUpdate)
Returns left/right (A/D) movement on X, forward/back (W/S) on Y, and up/down (E/C) on Z
moveAxis = Space.Input.MovementAxis
Enable or disable Click To Walk feature which allows movement of avatar by clicking the ground.
Space.Input.ClickToWalk = true
Return true if alternative fire is pressed
if Space.Input.AltFire == true then Space.Log("AltFire pressed") end
Return true if primary fire is pressed
if Space.Input.Fire == true then Space.Log("Fire pressed") end
Returns true if VR is active
if Space.Input.IsVRActive == true then Space.Log("VR is active") end
Returns true if VR is available
if Space.Input.IsVRAvailable == true then Space.Log("VR is available") end
Enable or disable Mouse Look feature
Space.Input.MouseLook = true
Returns the position of the axis of turning
turnAxis = Space.Input.TurnAxis
Returns position of Left VR Controller
posVRleft = Space.Input.VRLeftControllerPosition
Return rotation of Left VR Controller
rotVRleft = Space.Input.VRLeftControllerRotation
Returns position of Right VR Controller
posVRright = Space.Input.VRRightControllerPosition
Return rotation of Right VR Controller
rotVRright = Space.Input.VRRightControllerRotation
|