XRC Color Tool
The package video can be viewed here.
Overview
The XRC Color Tool privides a way to select hue and value quickly with minimal hand movements. The tool works by spawning a color panel in front of the controller when the input action is started such that the color picker is touching the color wheel. The color picker picks a color using a raycast method and choosing a color based on the pixel value of the texture. This color is updated immediately on both the UI panel and edit object.
Components
This package contains three main components: Color Tool, Color Tool Input, and Color Tool Feedback. Together, these components allow users to select colors through an immersive color wheel interface that appears in front of the controller, with the ability to adjust saturation via Poke Interactor.
Color Tool
The Color Tool component is responsible for the main logic of the XRC Color Tool package. It manages the color selection process, including the display of the color palette, the raycasting to sample colors, and the calculation of saturation values based on the interaction distance. Because ColorTool inherits from IEditTool if an Edit Object Provider is placed on the game object, this will provide the object.
Property | Description |
---|---|
Edit Object | The object currently being edited. |
Color Tool Menu UI | The menu which is activated with the input action reference from Color Tool Input |
Spawn Point | Controls the positioning of the color wheel relative to the controller. |
Raycast Distance | The distance a ray should be casted in order to select a color. |
Scale Factor | The factor to scale the tool by if the XR Rig has a scale different from 1. |
Color Tool Input
The Color Tool Input component processes input actions from the user. It detects when the input action is performed and triggers the appearance of the color wheel in front of the controller.
Property | Description |
---|---|
Toggle Color UI Action | The input action property associated with toggling on the Color Tool Menu UI. |
Color Tool Feedback
The Color Tool Feedback component provides visual and potentially haptic feedback to the user during the color selection process. This enhances the user's interactive experience by confirming actions such as color selection or saturation adjustments.
Throughout the process, the Color Tool Feedback component provides visual cues and, if applicable, haptic feedback to enhance the user's experience and convey information about the selected color and saturation level.
Property | Description |
---|---|
Dropper | A Mesh Renderer for the color picker tool. |
Color Tool Menu UI
Color Tool Menu UI component can be used to select a HSV color. This component holds the UI elements and subscribes to events from the Color Tool to update the preview color.
Property | Description |
---|---|
Color Wheel | A Game Object that will be toggled on when the color tool is activated. |
Follow Affordance | The XR Poke Follow Affordance used for updating the value for the HSV color picker. |
Color Image | The Image used by the UI panel to preview the currently selected color. |
XR Origin | The XR Origin used by the UI panel to set the scale and distance for the XR Poke Follow Affordance when the XR rig is scaled. |
Installation instructions
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 the URL to the package repository: https://github.com/xrcollaboratory/edu.cornell.xrc.tools.color.git in the prompt and click on Add (make sure your URL ends with ".git")
- If the repository is private, you will be asked to authenticate via your GitHub account. If you haven't been granted access to the repository you will not be able to install the package.
- The package should be installed into your project
- You can download the package samples from under the Samples tab in the Package Manager
Note: Even though the package documentation is public, several XRC packages are private and accessible only to XRC staff and students.
Requirements
This package was developed and tested using the following Unity Editor version:
- 2022.4.7f1 LTS
Dependencies: XRC Core, XR Interaction Toolkit, Input System.
Samples
XRC Color Tool
A sample showcasing the Color Tool implementation.