Fixing Object Placement Issues When Replacing GLTF Placeholders

Halikarnassos
Thu, 19 Dec 2024 13:42:53 +0000
Questions

Hello everyone! I’m currently developing a 3D game engine. I’m converting a USDZ file into GLTF and displaying it in the browser. I can see a room and placeholders (bounding boxes), and I want the placeholders to be replaced with rendered furniture. The replacement should ensure that the furniture is placed on the floor.

To achieve this, I recursively search for placeholder meshes in the GLTF file with names like “chair.” My script then looks into my model folder, retrieves the path to the corresponding 3D model, and replaces the placeholder.

The problem is that the replacement doesn’t work correctly. While it takes the bounding box values (like translation, rotation, etc.), the object is never placed on the floor. The placeholders, when not replaced, are always on the floor. For example, if I simply load the 3D scene with placeholders (bounding boxes) without replacing them with rendered models, the placeholders (bounding boxes) are always positioned correctly on the floor.

However, as soon as I replace them, the objects are no longer on the floor but are always hovering above it. I’ve tried solving this issue but haven’t succeeded. I also can’t find any resources or information on this. Now I’m feeling quite desperate and don’t know how to fix this.
The GLTF file contains specific meshes, nodes, and groups. For instance, my GLTF file also includes a floor. It is visible, and it has its dimensions, which I can see. However, I can never get the replaced object to align with the floor.
How can I ensure that the replaced models are placed on the floor and no longer hover above it?

I look forward to your solutions and ideas. Thank you very much, and have a great day!

3 posts - 2 participants