【问题标题】:Restrict the movement of an Object with ManipulationHandler-script attached限制带有 ManipulationHandler 脚本的对象的移动
【发布时间】:2019-10-26 12:24:38
【问题描述】:

我想通过附加在场景中的大球体上的 ManipulationHandler 脚本来移动小球体。

小球体的运动需要限制在大球体的“外壳”内。

我在不使用 Manipulation-handler 的情况下完成了 behaviour(链接提供了一个 gif),在 Update-function 中更新了小 Sphere 的 X 和 Y。

有没有一种方法可以在不重写 ManipulationHandler 的情况下实现相同的行为?

【问题讨论】:

    标签: c# unity3d hololens mrtk


    【解决方案1】:

    根据您的描述,MRTK 中的Solver 无需编写任何代码即可实现这一想法。如果您不限于仅出于其他原因使用 ManipulationHandler,我强烈建议您使用RadialView。您可以参考以下步骤使用 Solver 实现此功能:

    1. SolverHandlerRadialView 组件添加到小球体中。
    2. RadialView 组件的 Tacked Target Type 字段中选择 Custom Overrideset 属性。
    3. Transfom Override 字段设置为大球体。
    4. Radial View 组件中,将 MaxViewDegrees 设置为 360,将 Min DistanceMax Distance 设置为大球体的半径,
    5. 禁用平滑处理

    现在,小球体可以围绕大球体旋转,并与大球体保持固定距离。

    【讨论】:

    • 非常感谢,我不知道我可以将求解器用于此类事情。这正是我一直在寻找的行为:)
    猜你喜欢
    • 1970-01-01
    • 2017-11-25
    • 2023-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多