This project relies on System.Reactive
If not using this project's C# file
$ dotnet add package System.Reactive
Open the project settings: Project » Project Settings…, and head to the AutoLoad tab.
When selecting the Path to the "singleton", it is suggested to use the scene addons/gestures/TouchGestureController.tscn
(assuming the default path) rather than the script. Both instances should work just fine, but using the scene allows for modifying the settings from the inspector (by editing the scene in question).
This controller provides no useful interface for other classes; instead passing the events to the Input
singleton. As such, Node Name is of little relevance.
Some devices do not have a means to input any of the Supported gestures. Be it due to not having a touch screen, or only supporting a single touch. Development PC's are more prone to this limitation, which can be inconvenient.
To alleviate this issue somewhat, this project provides alternative means to input certain gestures; Instead relying on mouse clicks/movements, scrolling and some keyboard presses to modify the gestures on the fly.
⚠️ Warning: These emulated gestures aren't a perfect replacement for the ones based on touches. They should however make it possible for more easily creating cross-platform applications with different input methods.
Gesture where one finger makes contact with the screen for a very short time, with little movement. This gesture is typically used for selecting things or clicking on buttons.
Property | Description |
---|---|
Index |
Finger which triggered this touch event. |
Position |
Last known position of the finger that triggered this event before it no longer touched the screen. |
Property | Description |
---|---|
Index |
Finger which triggered this touch event. |
Position |
Position of the finger at the moment this event was triggered. |
Property | Description |
---|---|
Index |
Finger which triggered this touch event. |
Position |
Position of the finger that triggered |
Delta |
Indicates the movement of the finger relative to the previous frame. |
Gesture where two or more fingers all move in the same general direction. This gesture is typically used in contexts where at least two types of actions are associated with a drag gesture, where the number of fingers is used to determine which action to perform.
For example: A drawing application that supports zooming in and out might also want to support panning the canvas. Both drawing and panning would typically involve the dragging gesture.
Property | Description |
---|---|
Position |
Center of the fingers involved in the gesture. |
Delta |
Indicates the movement of the center relative to the previous frame. |
Gesture where two or more fingers either move toward or away from one another. This gesture is typically used for zooming in/out.
Property | Description |
---|---|
Position |
Center of the fingers involved in the gesture. |
Factor |
Positive numbers indicate the touch positions move away from eachother; negative numbers indicate they move toward eachother. |
Gesture where two or more fingers move in "circles" around a point. This gesture is typically used for rotating a canvas, or twisting knobs.
Property | Description |
---|---|
Position |
Center of the fingers involved in the gesture. |
Angle |
Rotation (in radians) |