Thank you very much for your answer, Perfect for loading 3D objects.
Now I have another problem: s
I made a project with raw JavaScript / Babylonjs, and I want to do it again with react / Babylonjs
Here is the project I want to redo:
https://sami-benghorbal.netlify.app/
Here is the current result with React:
https://sami-benghorbal-babylon-react.netlify.app/
My problems :
1 / texture assignment
2 / turned the model
3 / Adding the hdrSkybox environment
4 / scaling and moving the model
This is the code I am using on React, can you please help me
thank you in advance
import React, {useState, Fragment} from ‘react’;
import * as BABYLON from ‘babylonjs’;
import ‘babylonjs-loaders’;
import “@babylonjs/loaders/glTF”;
import BabylonScene from ‘./Babylon.jsx’; // import the component above linking to file we just created.
export default function Modal (props) {
const onSceneMount = (e: SceneEventArgs) => {
const { canvas, scene, engine } = e;
const camera = new BABYLON.ArcRotateCamera(“Camera”, Math.PI / 2, Math.PI / 2, 2, new BABYLON.Vector3(0,0,5), scene);
camera.setTarget(BABYLON.Vector3.Zero());
camera.attachControl(canvas, true);
const light = new BABYLON.HemisphericLight(“light1”, new BABYLON.Vector3(0, 1, 0), scene);
light.intensity = 0.7;
engine.runRenderLoop(() => { scene.render(); });
BABYLON.SceneLoader.Append("./assets/babylonjs/models/", props.Nom , scene, function (newMeshes) { });
const Modal = (e) => {
const { closeModal } =useState(props.closeModal);
};
}
return (
<Fragment>
<div className="overlay">
<div className="content">
<BabylonScene onSceneMount={onSceneMount} />
<i class="fa fa-times" onClick={props.closeModal} aria-hidden="true"></i>
</div>
</div>
</Fragment>
)
}