Exercise - Create intelligent object placements with solvers - Training | Microsoft Learn
Solvers are one of the components of the Mixed Reality Toolkit (MRTK). Let's take a look at two types of solvers and their respective functionalities.
Location of solvers in the MRTK
The MRTK's solvers are located in the MRTK SDK folder. To see the available solvers in your project, in the Project window, go to Packages > Mixed Reality Toolkit Foundation > SDK. Then select Features > Utilities > Solvers.
The Tap To Place solver
Use the Tap To Place solver to reposition objects. Here's how:
-
In the Hierarchy window, select the RoverExplorer > RoverAssembly object. Then, in Inspector, use Add Component to add the Tap To Place (Script) component. Configure the component as follows:
a. Verify that the SolverHandler component's Tracked Target Type is set to Head.
b. Clear Use Default Surface Normal Offset, and ensure that Surface Normal Offset is set to 0.
c. Select the Keep Orientation Vertical checkbox.
d. From the Magnetic Surfaces > Element 0 dropdown list, clear all options except Spatial Awareness.
2.With the RoverAssembly object still selected in the Hierarchy window, in the Inspector window, locate the On Placing Started () event. Select the + icon to add a new event.
3.Configure the event as follows:
a. Assign the RoverAssembly object as a listener for the On Placing Started () event, by dragging it from Hierarchy into the None (Object) field.
b. From the No Function dropdown list, select TapToPlace > float SurfaceNormalOffset to update the SurfaceNormalOffset property value when the event is triggered.
c. Verify that the argument is set to 0.
文章评论