物体靠近时的磁吸效果

本文介绍了MixedRealityToolkit(MRTK)中的解算器类型,重点讲解了TapToPlace解算器的使用方法,包括设置位置、配置事件和组件参数。通过实例展示了如何在RoverExplorer中实现物体的智能定位。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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:

  1. 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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值