<!-- dans le head --><scriptsrc="/skyGradient.js"></script><!-- dans le body --><a-entityid="sky"geometry="primitive: sphere; radius: 65;"material="shader: skyGradient; colorTop: #353449; colorBottom: #BC483E; side: back"></a-entity>
/* global AFRAME, THREE *//*** Loads and setup ground model.*/AFRAME.registerComponent('ground',{init:function(){this.onModelLoaded=this.onModelLoaded.bind(this);this.el.addEventListener('model-loaded',this.onModelLoaded);this.el.setAttribute('gltf-model','#ground');},onModelLoaded:function(evt){varmodel=evt.detail.model;model.children.forEach(function(value){value.receiveShadow=true;value.material.flatShading=THREE.FlatShading;});}});
<a-assets><a-asset-itemid="ground"src="https://cdn.glitch.global/daa3d4b3-f117-42b3-904f-3f14e4a78ba9/ground2.glb?v=1746539192732"><!-- changer le lien vers le fichier glb --></a-asset-item></a-assets><a-entityground></a-entity>
Alternative solution for using pre-designed environments
The aframe-environment-component library is very useful for using several very different terrains in an A-frame project.
Image: a-frame-environment-component repository
To use aframe-environment-component:
Use version 1.7.0 of A-Frame
Then include the file: <script src="https://unpkg.com/aframe-environment-component@1.5.x/dist/aframe-environment-component.min.js"></script>
Finally, add the environment to the scene: <a-entity environment="preset: <name of the preset>"></a-entity>