【问题标题】:A-Frame Super Hands rotate grabbed objectA-Frame Super Hands 旋转抓取的物体
【发布时间】:2021-04-08 01:04:11
【问题描述】:

我正在使用 A-Frame、A-Frame Physics 和 Super Hands。我有一个简单的场景,我可以在其中放置一个对象(现在只是一个盒子)和一些控制器。当我在 VR 中查看这个场景时,我可以抓住盒子、移动它并调整它的大小,但我无法旋转或旋转对象。

我希望旋转与握住物体的手的旋转相匹配。所以如果我用右手抓住一个物体,然后转动那只手,这个物体应该旋转相同的量。

<a-scene
      style="height: calc(100vh - 5rem)"
      embedded
      physics="debug: true; gravity: 0;"
    >
      <a-entity>
        <a-camera></a-camera>
        <a-entity
          sphere-collider="objects: a-box"
          super-hands
          hand-controls="hand: left"
        ></a-entity>
        <a-entity
          sphere-collider="objects: a-box"
          super-hands
          hand-controls="hand: right"
        ></a-entity>
      </a-entity>

      <a-box
        color="blue"
        position="0 1.4 -1"
        depth="0.1"
        height="0.8"
        width="1"
        grabbable
        stretchable
        draggable
        dynamic-body
      >
      </a-box>
    </a-scene>```

【问题讨论】:

    标签: aframe webxr


    【解决方案1】:

    对于旋转,superhands 使用 aframe-physics-system 约束。

    要绑定手和目标对象之间的约束,它们都需要是物理体。

    在手上添加一个静态身体组件就足以让这一切正常工作。

    例如

    static-body="shape: sphere; sphereRadius: 0.02"
    

    所以完整的手实体看起来像:

        <a-entity
          sphere-collider="objects: a-box"
          super-hands
          static-body="shape: sphere; sphereRadius: 0.02"
          hand-controls="hand: left"
        ></a-entity>
    

    这是一个显示此工作的故障:

    https://foul-pointy-collard.glitch.me/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多