XRC Line Tool
Overview
This package provides a tool for creating a basic line object. It is designed to work with the XR Interaction Toolkit and follows component based architecture for the tools, input, and feedback. By building off of XRI componentets like XR Grab Interactable, we can leverage some of the design choices of XRI.
The package video can be viewed here.
Components
Line Tool
The Line Tool component is responsible for creating a list of points, adding an XR Grab Interactable to the parent object, and managing the points when new lines are created. Line Tool is an implementation of IRunnable, and therefore implements StartRun and StopRun. The set of points created can be accessed through a serialized property called linePoints. Whenever linePoints is updated, the event lineUpdated
is invoked so that any listeners can respond accordingly. This is used in Line Tool Feedback for example, which updates the Line Renderer whenever the event is invoked.
Property | Description |
---|---|
Cursor Transform | Transform that represents the tip of the marker or drawing tool. |
Min Draw Distance | Minimum distance required between consecutive points to continue drawing. |
Line Tool Input
Line Tool Input sets up input listeners to detect when the user initiates a draw or clear action. You attach this component to the same game object as Line Tool to ensure that user inputs are correctly interpreted for drawing actions.
Property | Description |
---|---|
Draw Action | The Input Action Reference used for drawing the line tool. |
Clear Action | The Input Action Reference used for clearing the line tool. |
Line Tool Feedback
The Line Tool Feedback component handles the visual feedback of the line Tool. In this simple example, the feedback is just a Line Renderer representing the points generated by the Line Tool. The appearance of the line can be altered by changing the line width, color, or material.
Property | Description |
---|---|
Line Color | The color to be applied to the line. |
Line Width | The width of the line. |
Line Material | The material of the line. |
Installation instructions
Package Manager
Note
Before you install this package, you would need to install edu.cornell.xrc.core. Follow these installation instructions to fulfill this dependency. To install this package, follow these steps:
- In the Unity Editor, click on Window > Package Manager
- Click the + button and choose Add package from git URL option
- Paste this URL https://github.com/xrcollaboratory/edu.cornell.xrc.tools.line.git in the prompt and click on Add
- You might have to authenticate as this is a private repository
- The package should be installed into your project
- You can download Samples from under Samples
Requirements
This version of XRC Line Tool Tool is compatible with the following versions of the Unity Editor:
- 2022.4.7f1 LTS
Dependencies:
Samples
The package comes with a number of samples which can be installed directly from the Package Manager (from Unity's main menu, go to Window > Package Manager). Select the XRC Line Tool, then click Import next to a sample to copy it into the current project.
Sample | Description |
---|---|
XRC Line Tool | A basic XR scene setup with a line Tool. All the input and feedback is already configured. |