Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scaling Aframe model

Tags:

aframe

When loading an objects from the assets manager in Aframe, the model appears too large, so I want to rescale it.

On the Aframe website, it is stated that If you don’t see your model, try scaling it down. OBJ models generally have extremely large scales in comparison to A-Frame’s scale.

But how can I do this? I tried to use the same depth/height/width parameters as in a element but no success.

Here is my code:

<html>
  <head>
    <script src="https://aframe.io/releases/0.3.2/aframe.min.js"></script>
  </head>
  <body>
  <a-scene>
    <a-assets>
      <a-asset-item id="test-obj" src="test.obj"></a-asset-item>
      <a-asset-item id="test-mtl" src="test.mtl"></a-asset-item>
    </a-assets>
    <a-obj-model src="#test-obj" mtl="#test-mtl" depth="2" height="0.5" width="0.5">
    </a-obj-model>
  </a-scene>
  </body>
</html>
like image 258
bear Avatar asked Dec 10 '22 13:12

bear


1 Answers

The scale component is what you want, for external models:

<a-obj-model src="#test-obj" mtl="#test-mtl" scale="0.1 0.1 0.1">
</a-obj-model>

https://aframe.io/docs/0.3.0/components/scale.html

like image 160
Don McCurdy Avatar answered Jan 12 '23 04:01

Don McCurdy