【问题标题】:How to read json text with react-three-fiberHow to read json text with react-three-fiber
【发布时间】:2022-12-02 11:17:22
【问题描述】:

I have my gltf data as a JSON, there fore variable gltf is like this

{
    "asset" : {
        "generator" : "Khronos glTF Blender I/O v3.2.43",
        "version" : "2.0"
    },
    "scene" : 0,
    "scenes" : [
        {
            "name" : "Scene",
            "nodes" : [
                0
            ]
        }
    ],
...........

I know how to load gltf by file path

  const gltf = useLoader(GLTFLoader, ". /filapath.gltf");
  return (
    <>
      <primitive object={gltf.scene} scale={0.4} />
    </>
  );

How can I view JSON directly in SCENE? not useLoader with filapath? like

const gltf = "JSON FILE"
return (
    <>
      <primitive object={gltf.scene} scale={0.4} />
    </>
  );

【问题讨论】:

    标签: javascript rendering render gltf react-three-fiber


    【解决方案1】:

    Did you manage to find the answer to this?

    【讨论】:

    猜你喜欢
    • 2020-10-31
    • 2022-07-28
    • 2021-08-20
    • 2019-10-27
    • 2022-01-25
    • 1970-01-01
    • 2021-05-13
    • 2020-01-20
    相关资源
    最近更新 更多