Closed Roy-Ermers closed 4 years ago
Hi.. hm, I see what's going on here but I'm not sure there's a solid fix as of today. Ideally you would want to register the plant block as having a customMesh
, which I assume you're doing, but also marked as being a fluid and as having the the same blockMaterial that you're using for your water blocks. I'm testing this in the test world with code like this:
blockIDs.waterObject = noa.registry.registerBlock(_id++, {
blockMesh: mesh,
opaque: false,
material: 'water',
fluid: true,
})
However as of today the engine draws a terrain mesh surface between a block like that and a regular water block. I think this could be a relatively easy fix but I'm not sure.
One way to work around it, though not ideal, would be that you could define the plant block as a regular water block, but with lifecycle events, which you could use to create/remove your own arbitrary meshes. E.g.:
function createPlantMesh(x,y,z) { /* .... */ }
function removePlantMesh(x,y,z) { /* .... */ }
blockIDs.waterObject = noa.registry.registerBlock(_id++, {
opaque: false,
material: 'water',
fluid: true,
onLoad: createPlantMesh,
onSet: createPlantMesh,
onUnload: removePlantMesh,
onUnset: removePlantMesh,
})
That should work today, but it's not ideal since it's troublesome to manually wrangle your own meshes.
Hi, I've just pushed a commit which I believe fixes this. Can you try it, with the voxel registered as I described above?
blockIDs.waterObject = noa.registry.registerBlock(_id++, {
blockMesh: mesh,
opaque: false,
material: 'water',
fluid: true,
})
Nice that works! thank you!
Right now i'm adding vegetation to oceans, but i'm having problems with underwater plants. right now they look like this. do you have any idea how to fix this?