XRC Mesh Tool
The package video can be viewed here.
Overview
This package provides a tool for manipulating the vertices of a 3D mesh. It is designed to work with the XR Interaction Toolkit and follows component based architecture for the tools, input, and feedback.
Switching into mesh edit mode is done by pressing the button associated with the Input Action Asset while the object is selected. When entering the mesh edit mode, the mesh should snap back into it's initial position and handles appear on the mesh indicating the affordance for editing. Handles respond to the standard selectEntered, and hoverEntered events from the XR Base Interactable using the XR Interaction Manager.
Package contents
Mesh Tool
Mesh Tool is a logic component that allows vertex positions of a mesh object to be manipulated. It inherits from IEditTool and has an Edit Object
exposed in the inspector. Edit Object
reference can be assigned directly in the inspector or by adding an Edit Object Provider which will provide the object when edit mode is selected. If no Edit Object
is assigned, you must use the Edit Object Provider.
By exposing a List<Vector3>
which is a unique list of vertex positions, external classes can alter these positions which in turn will alter the mesh. We are getting the current target object directly from the XR Base Interactor during the selectEntered event.
Property | Description |
---|---|
Edit Object | Reference to the currently selected edit object. |
Mesh Tool Handles
A handles component responsible for sending updated vertex positions to the MeshTool. In this example, we instantiate GrabInteractables as grabbable handles which can move the vertices. Events for selectEntered and selectExited are used to create a list of currently selected handles. Those handles then send the Mesh Tool updated vertex positions, driving the mesh vertices.
Property | Description |
---|---|
Handle Color | The color of the handles used to move the the vertices of the mesh. |
Handle Hover Color | The hover color of the handles used to move the the vertices of the mesh. |
Mesh Tool Feedback
A feedback component that allows options to visualize the mesh wireframe, and assign a color to the interactable handles. The color set in feedback is sent to the Tool because the logic component is treated as a central component which all other components will reference.
Property | Description |
---|---|
Visualize Triangles | A bool to decide wheter we want to add line renderers to the faces as feedback. |
Line Width | The line width of the line renderers used to render the faces of the mesh. |
Line Color | The color of the line renderers used to render the faces of the mesh. |
Mesh Tool Input
An input component used for toggling between edit modes.
Property | Description |
---|---|
Toggle Edit Action | Input Action reference to toggle edit mode. |
Installation instructions
Package Manager
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.mesh.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 Mesh Tools is compatible with the following versions of the Unity Editor:
- 2021.3 and later
- This package has a dependency on Input System
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 Tools Mesh, then click Import next to a sample to copy it into the current project.
Sample | Description |
---|---|
Mesh Tool | A basic XR scene setup with a simple cube mesh that can be edited. All the input and feedback is already configured. |
Next Steps
Add Edge and Face manipulation to the MeshTool. This way, we can swp between edit modes, and the should provide feedback for selecting edges and faces.