8thwall / web

8th Wall Web projects and resources.
515 stars 326 forks source link

a-entity attribute position not work for gltf-model #138

Closed phanhongphucit closed 4 years ago

phanhongphucit commented 4 years ago

Hi,

I have an image recognization and would like to change the position of 3D model relative to the image. But the following code with attribute position does not work:

<a-entity xrextras-named-image-target="name: fox">
    <!-- Add a child entity that can be rotated independently of the image target. -->
    <a-entity xrextras-one-finger-rotate gltf-model="#mech_drone_glb" position="-100 100 0"></a-entity>
</a-entity>

Could you please help? Thank you

atomarch commented 4 years ago

You are setting a very large position offset from the image target. The model is likely just very far away and therefore you don't see it in view. Prove this to yourself by setting a much smaller position offset.

Original:

  <a-entity xrextras-named-image-target="name: model-target">
    <!-- Add a child entity that can be rotated independently of the image target. -->
    <a-entity xrextras-one-finger-rotate gltf-model="#jelly-glb"></a-entity>
  </a-entity>

Result: no-offset

With offset:

  <a-entity xrextras-named-image-target="name: model-target">
    <!-- Add a child entity that can be rotated independently of the image target. -->
    <a-entity position="0.5 0.5 0"xrextras-one-finger-rotate gltf-model="#jelly-glb"></a-entity>
  </a-entity>

Result: with-offset