Closed csf30816 closed 4 years ago
Hi, I've never used glb
or Babylon's asset-related features, but at first blush this sounds like an async issue. It looks like you're registering the custom block after Babyon finishes loading and processing the asset, but does worldgen (or just creating the noa instance) get deferred until after that? If not then probably noa is trying to create terrain with a block that hasn't been registered yet. (which I'd think would throw an error, but there could be a bug.)
If that's not the issue, there is some sample code for custom blocks in the test world - a mesh is created here, and then the block is registered here. That should work for any kind of Babylon mesh, unless there's something special about meshes from the asset system that I don't know about.
I do worldgen after registering the blocks and I register the blocks after the mesh has been completely loaded. Its either a problem with my mesh or something else.
GLBs/GLTFs in Babylon are loaded with a few wrapping meshes. Usually a Mesh -> TransformNode -> [real content here]
I suspect the issue you're seeing is that its only adding that first mesh to the scene.
That's probably it. I noticed there were two different meshes I just selected the one that had the right id
Assuming this is fixed, please update if not!
Hi, as you might've already guessed I am a noob with BabylonJS. I want to add a grass object that I made in Blender into
noa-engine
so I used the AssetManager andglb
format.And then I register that mesh like this.
And then in my
worldgen.js
file, I place the grass places. Originally nothing showed up and the blocks were just clear blocks. Then I added a white material and the boxes showed up as white but no grass. In Blender, I applied all the transforms but to no avail. I'm just wondering if someone here could give me an example on how to use custom mesh with an importedglb
(obj
,fbx
, etc.)