We’re releasing support for trackpad gestures. This enables easy and intuitive game controls on supported laptops.
This enables the user to fully control the camera without having to hold down the right mouse button:
- 1 finger = cursor
- 2 fingers together = camera control
- 2 fingers pinch in/out = camera zoom
Gestures are exposed by a new event, PointerAction.
UserInputService.PointerAction(float wheel, Vector2 pan, float pinch, bool gameProcessedEvent).
float wheel: Discrete wheel input from a physical mouse.
Vector2 pan: Horizontal and vertical two-finger pan on a trackpad.
float pinch: Pinch gesture on a trackpad.
bool gameProcessedEvent: Determines if the engine has processed the input (ie has a gui with Active=true swallowed the event).
Briefly, arguments from
PointerAction are combined additively into user actions. Zooming in 3D space is calculated as
wheel + pinch, and 2D vertical scrolling is calculated as
wheel + pan.Y.
You can inspect the source of the Roblox CameraScript to find a usage example.
Compatibility & next steps
- Gestures are fully supported on MacOS.
- We are actively working on support for Windows machines, as well as a fallback control scheme for systems lacking supported hardware.
- Due to technical limitations, Roblox Studio does not support trackpad gestures.
We’ll attempt to turn this feature on next Wednesday (9/11/2019). If all goes well it will stay on.
You must have an up-to-date copy of the PlayerScripts for full gesture support.
If you don’t fork the PlayerScripts, you don’t have to do anything – your game will magically support trackpad gestures after next week.
Old, forked copies of the PlayerScript used the now-legacy MouseWheel input event. These must be migrated to the new PointerAction API for full gesture support.
Don’t be afraid to pop me a DM if you need help integrating PointerActions into your custom camera controller.