Implementing tube navigation for Neon Atelier



The process of neon light crafting requires nimble grips, as the craftsman brings destinated section onto the torch, softening the section before twisting it into desired curve. In Project Neon Atelier, we implement this process in VR with Unity's XR Interaction Toolkit.

XR Interaction Toolkit provides us all-rounded prefabs and a straightforward workflow, saving us from setup the complex VR scenes and controller controller, allowing us to spend more time tailoring it for the interactions of neon light crafting, with features beyond the workflow commonly taught by the online tutorials. While we have yet secured an VR device for testing, the XR Device Simulator from the toolkit allows us to test with the more simple interactions with keyboard and mouse controls.

Our implementation relies significantly on the toolkit's NearFarInteractor and XRGrabInteractable components, for the mechanism of tube grabbing. XRGrabInteractable natively supports two-hand grabbing through its SelectMode enum, and is able to fetch its children's colliders for grab detection. As the neon tube is to be held in two hands, we added two collider object under the XRGrabInteractable. We also separate  the hand grabbing on left and right, by setting the two colliders into LeftHandOnly and RightHandOnly physics layer, corresponding to our NearFarInteractor setting in SphereInteractionCaster 's Physic Layer Mask setting. This together gives us a VR object that move and rotates accordingly as left and right controller grab and move around.

One excellent potential of the XRGrabInteractable, is that grabbable colliders can be moved during runtime. This can be utilized to update the grips positions on our neon tube as the crafting progress. To utilize this feature, we implemented an custom TubeGripManager script, which reads from a given PathContainer component object (another custom implementation, see below), then map the left and right grab collider into appropriate position. Through the mechanism is as straightforward as manipulate the Transform object, we also have to track and manage both the grip of player, hence TubeGripManager at this stage already contained quite a long list of variables and methods.

The PathContainer object mentioned above holds the data of a neon light mission, including the tube 's blend shape(Tube model), reference object of each steps (Stepholder), and exposes a set of public references and functions for other scripts to work with. (Below is an example of its hierarchy)

Each path step (Step objects under Stepholder) holds transform reference of the grip handles (Left/Right grip), set of torching section to be held above the flame. and also bend grip that define the bending motion curve(a topic of the upcoming blog). 

The PathContainer object follows the player's grip by binding to TubeGripManager using Unity's PositionConstraint and Rotation Constraint. Instead of directly being a child of TubeGripManager and clamping together with all other tube object, it would make better sense for these tube object to have there dedicated holder.

The torch sections of within a step is a series of collider that are expected to be place into the flame area one by one. We implement a simple TorchableSection script that detection collision and tracking the time requirement for torching. The TorchableSection is implemented to disable itself at first except when it is the first step, and is able to activate the next section as it is finished being torched.  

The holder of the torch section is inactive by default, and is activated by the TubeGripManager when both grips are holded. For case where a step is merely for moving and need no torching, we can attach a simple SignalNoTorch script with OnEnble() that called the TubeGripManager to move onto next grip as soon as the player hold the two grips. 

With the above implementations, our prototypes is now ready for some basic tube grabbing and torching. From now on, we is expecting to implement the tube bending interaction, then bind these steps with with dynamic gameplay instructions. 

We are looking forward to release more updates soon. Thanks for tuning in.🙂

_

Near-Far Interactor | XR Interaction Toolkit | 3.2.1. (n.d.). https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.2/manual/near-far-interactor.html

XR Device Simulator overview | XR Interaction Toolkit | 2.3.2. (n.d.). https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@2.3/manual/xr-device-simulator-overview.html

XR Grab Interactable | XR Interaction Toolkit | 3.2.1. (n.d.). https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.2/manual/xr-grab-interactable.html