PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

TouchRotate

The TouchRotate event fires when the player uses two fingers to make a pinch or pull gesture on the UI element using a touch-enabled device. Rotation occurs when the angle of the line between two fingers changes. This event fires in conjunction with GuiObject/TouchPan. This event is useful for allowing the player to manipulate the rotation of UI elements on the screen.

This event fires with a table of DataType/Vector2 that describe the relative screen positions of the fingers involved in the gesture. In addition, it fires several times with multiple Enum/UserInputStates: Begin after a brief delay, Change when the player moves a finger during the gesture and finally once more with End.

Since this event requires at least two fingers, it is not possible to be simulated in Studio using the emulator and a mouse; you must have a real touch-enabled device (and also least two fingers, try asking a friend).

This event is part of a family of touch-related events. Other events like this one are GuiObject/TouchTap, GuiObject/TouchPinch, GuiObject/TouchPan, GuiObject/TouchLongPress and Guiobject/TouchSwipe. In addition, UserInputService has a similarly named event that is not restricted to a specific UI element: UserInputService/TouchRotate.

Parameters

Name Type Default Description

Code Samples


Touch Rotation

This code sample is meant for a LocalScript within an inner Frame that is inside an outer Frame, or other GuiObject. It allows the player to rotate the inner frame by performing a GuiObject/TouchRotate gesture on the outer frame.