I want to know if I can import a 3d model from spline to a three js project. If yes, how can I do it? I want to create a 3d model and include it in three js as a geo
Yes, you can, you can export it as .gltf
in spline:
and then import it in three.js like this:
//import the loader from cdn or directly from three package
//import { GLTFLoader } from 'https://unpkg.com/three@0.126.0/examples/js/loaders/GLTFLoader.js'
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'
// Instantiate it
const gltfLoader = new GLTFLoader()
//Load it
gltfLoader.load(
'path of your model .gltf',
(gltf) =>
{
//add it to the scene
scene.add(gltf.scene.children[0])
}
)