Throw Lab demonstrates how to implement realistic grabbing and throwing mechanics in Lens Studio using hand tracking and physics. It features a modular, componentized architecture supporting three distinct object types — Balls, Rackets, and Darts — each with unique grab gestures, rotation behaviors, and throw physics. By exploring this project, you will gain a practical understanding of how to combine the Gesture Module, Physics, and Specs Interaction Kit to build engaging, hand-driven AR interactions.
NOTE: This project will only work for the Specs platform.
Designing Lenses for Specs offers all-new possibilities to rethink user interaction with digital spaces and the physical world. Get started using our Design Guidelines
- Lens Studio: v5.15.4+
Note: Ensure Lens Studio is compatible with Specs for your Specs device and OS versions.
- Specs OS Version: v5.64+
- Specs App iOS: v0.64+
- Specs App Android: v0.64+
To update your Specs device and mobile app, please refer to this guide.
You can download the latest version of Lens Studio from here.
To obtain the project folder, clone the repository.
IMPORTANT: This project uses Git Large Files Support (LFS). Downloading a zip file using the green button on GitHub will not work. You must clone the project with a version of git that has LFS. You can download Git LFS here.
The project should be pre-configured to get you started without any additional steps. However, if you encounter issues in the Logger Panel, please ensure your Lens Studio environment is set up for Specs.
GestureManager.ts - Manages hand tracking, finger-tip collider overlap detection, and dispatches pinch/grab events to trigger object grabs and releases.
GrabbableObject.ts - Core grab-and-throw logic that controls physics state, hand-velocity-based throw forces, and type-specific rotation behavior for Ball, Racket, and Dart objects.
MatchTransform.ts - Smoothly lerps an object's position and rotation toward a target point each frame, with an offset transition from the initial grab position to a comfortable hold distance.
DartStick.ts - Detects dart collision with the dartboard and sticks the dart in place when the hit angle is within the acceptable threshold.
ToolPickerBehavior.ts - Monitors spawn points and automatically respawns a new tool instance whenever the current one is grabbed or moves out of range.
- Open the project in Lens Studio v5.15.4 or later.
- In the Preview panel, select the Specs device target.
- Use the Hand Simulation controls to move virtual hand positions near one of the spawned objects (Ball, Racket, or Dart).
- Trigger a Pinch gesture to grab a Ball or Dart, or a Grab gesture to pick up the Racket.
- Move the simulated hand and release the gesture to observe the throw physics and auto-respawn behavior.
- Build and push the Lens to your Specs device from Lens Studio.
- Look at the spawn area to see the spawned objects (Balls, Racket, Darts).
- Move your index finger and thumb close to a Ball or Dart, then perform a Pinch gesture to grab it.
- Move your hand naturally and release the pinch to throw. Observe velocity-based throw force.
- To grab the Racket, close your full hand (Grab gesture) while touching it.
- For Darts, throw toward the dartboard — a straight enough throw will cause the dart to stick.
If you have any questions or need assistance, please don't hesitate to reach out. Our community is here to help, and you can connect with us and ask for support here. We look forward to hearing from you and are excited to assist you on your journey!
Feel free to provide improvements or suggestions or directly contributing via merge request. By sharing insights, you help everyone else build better Lenses.
Built with <3 by the Specs team
