-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3D Objects Not Rendering in Nodes When Using FBX Loader #539
Comments
@FrancicoVerdu thanks for reaching out. I'm not sure how you are adding the model to a node as that code is not mentioned. The best would be if you could create a simple example on https://codesandbox.io/ so that we can have a better look. |
Thank you for your response! In the code, you'll find a variable called In the example, when the 3D model is loaded into the nodes, it's only being rendered once instead of being added to each corresponding node. I tested the same example locally, and the same thing happens. I'm not sure why, in my other code, it's not being rendered at all. |
@FrancicoVerdu I see. The real issue is that the fbx model objects are not being cloned correctly when included multiple times. Here's a longer explanation of it: And here's a fixed version of the sandbox that uses SkeletonUtils clone: |
Thank you so much for the help! I’ve noticed an issue with the example you provided: when trying to drag one of the nodes, the mouse position doesn’t match the node's position. |
@FrancicoVerdu that is somehow related to the |
After running several tests, I've concluded that the best way to use 3D objects in the nodes is by utilizing the GLB format and setting nodeThreeObjectExtend={true}. This significantly improves the application's performance. The 3D object should remain within the default sphere because if you try to drag a 3D element, the following errors occur: 3d-force-graph.mjs:410 Uncaught TypeError: Cannot read properties of null (reading 'position'), and 3d-force-graph.mjs:434 Uncaught TypeError: Cannot read properties of null (reading '__data'). Adjusting the size of the sphere to match the model also solves the cursor position issue. |
Describe the bug
When loading 3D objects via FBX loaders from three.js, I can visualize the element when adding it directly to the scene using graphRef.current.scene().add(element);. However, when trying to load the same 3D object into a node, the object does not appear as expected.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The 3D object should be visible when loaded into a node, just as it is when added directly to the scene.
Screenshots
The first image shows a cube with a texture that has been added directly to the scene, while the nodes are displayed with their default settings.
The second image shows that nothing is visible when the 3D object is attempted to be loaded into the nodes.
The third image shows the error returned in the browser console, along with a console.log of the element that I attempted to add.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: