Manuel Santi
Manuel Santi

Reputation: 1132

AR.js and aframe manage my .gltf position and dimensions

I am new to ar.js and Aframe, i wrote a simple code form displat on a hito pattern a gltf objct:

<!-- include A-Frame obviously -->
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<!-- include ar.js for A-Frame -->
<script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>

<body style='margin : 0px; overflow: hidden;'>
  <a-scene embedded arjs>
    <!-- define your gltf asset -->
    <a-assets>
      <a-asset-item id="tree" src="models/gltf/manovella.gltf"></a-asset-item>
    </a-assets>
    <a-entity gltf-model="#tree"></a-entity>
    <!-- define a camera which will move according to the marker position -->
    <a-marker-camera preset='hiro'></a-marker-camera>
  </a-scene>
</body>

All works dine, my object become visible but is so small and wrong positioned:

enter image description here

i try to search in aframe documentation about a-asset-item but cannot find anityng about position dimension and rotation.

Someone can help me for understand how manage apparence of my object?

So many thanks in advance

Upvotes: 0

Views: 1841

Answers (1)

St&#233;phane Albanese
St&#233;phane Albanese

Reputation: 560

All <a-entity> elements in A-Frame have position, rotation and scale components that you can use to manage your model like any entity. You can use them like this :

<a-entity gltf-model="#tree" position="0 3 0" rotation="0 90 0" scale="3 3 3"

If you didn't read it yet, there are lots of information on A-Frame documentation, you can start with this guide for the fondamentals.

Upvotes: 1

Related Questions