XRC Scale Tool
The package video can be viewed here.
Overview
This package provides a tool for manipulating the scale of a 3D 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.
Package contents
Scale Tool
Property | Description |
---|---|
Edit Object | The currently selected game object. |
Scale | The scale of the currently selected game object. |
The ScaleTool component is responsible for managing the control logic of per-axis scaling using grabbable axis tools. ScaleTool inherits from IEditTool, and therefore implements StartRun
and StopRun
. It holds a reference of the Edit Object which is the currently selected object to be scaled. The Edit Object reference can be assigned directly through the inspector, or by making use of the Edit Object Provider.
The Scale Tool calculates and applies scaling transformations based on the Scale Tool Handles. The axis handles are placed at a slight offset from the mesh bounds. To implement per-axis scaling, you attach this component to an empty game object and assign the reference to the object you want to make scalable.
Scale Tool Feedback
Property | Description |
---|---|
Hover Scale Factor | A small scale factor applied to the handles on hover. |
Show Line Feedback | The bool flag that allows line renderers to be enabled/disabled. |
The Scale Tool Feedback component handles the visual feedback during the per-axis scaling interaction when the scale Tool is selected. The main feedback affordance for scaling is on the handles themselves. It manages the presentation of interactive elements, including highlighting, scaling effects, and auditory cues, to provide enhanced user experience. It requires the Scale Tool component to reference the current state of the Tool and set the current axis. You can attach this component to the same game object as Scale Tool. Users will interact with the ScaleHandles for scaling, allowing it to manage feedback events tied to different interaction stages. The Hover Scale Factor allow the handles to be scaled by different amounts on hover, and Show Line Feedback can be used to toggle whether line renderers for each axis should be displayed or not.
Property | Description |
---|---|
Toggle Scale Action | The Input Action Reference used for toggling the scale tool. |
Scale Tool Input sets up input listeners to detect when the user initiates a toggle edit mode action. You attach this component to the same game object as Scale Tool to ensure that user inputs are correctly interpreted for scaling actions. Note : This component is not needed if using Edit Object Provider.
Scale Tool Handles
Property | Description |
---|---|
Handle Offset | The offset through which to displace the handle from the mesh bounds. |
The Scale Tool Handles class is responsible for generating the interactive handles on the target object. When in edit mode, the handles are generated at the mesh bounds and displaced by a small offset. You attach this class to the same game object as Scale Tool, allowing users to interact with them for per-axis scaling. Each handle ueses a XR General Grab Transformer to constrain the handle along a particular axis.
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.scale.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 Scale Tool Tool is compatible with the following versions of the Unity Editor:
- 2021.3 and later
- This package has a dependency on Input System
- This package has a dependency on XR Interaction Toolkit
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 Scale Tool, then click Import next to a sample to copy it into the current project.
Sample | Description |
---|---|
XRC Scale Tool | A basic XR scene setup with a few scalable objects that can be adjusted using the scale Tool. All the input and feedback is already configured. |