Closed FlorentP42 closed 1 year ago
Spawning voxels in a shape like this would be really cool and I might add this later on, but it will definitely come with limitations. The engine uses a fixed palette per shape, so you would need to manage the palette as well and only use very few materials per shape.
Okay so if I understand correctly the palette you see when editing an object in MagicVoxel is still used internally to render the shapes ingame? In that case that might limit a lot what you can do yeah... Unless you are able to edit that palette as runtime as well obviously ^^
I'm a bit curoious how the voxbox spawning for a full shape works then: it is possible to define any color and meterial properties for a shape you spawn in the xml without having to specify a particular palette, does it generate a default one for you or something?
Is your feature request related to a problem (if not, explain why you think this feature should be added)? Please describe.
So I was hoping the Spawn update would somehow enable this, but it appear to not be the case... If an actual engine limitation actually prevent this from being possible, please let me know.
Describe the solution you'd like
SetShapeMaterialAtIndex(handle, x, y, z, type, r, g, b, a)
Pretty much the counterpart ofGetShapeMaterialAtIndex()
, that would let you set any material you want with any color you want at any coordinate in a shape.Here would be the expected behavior for all the cases I could think of:
One side case that might result of this is that some voxels are created in the shape that are not attached to existing voxels of that shape. The expected behavior in that case would be to split the shape in as many shapes as needed. This is already happening after
MakeHole()
orExplosion()
, so I believe the engine handles that already. If not then maybe having one pass at the end of each cycle on shapes that were edited throughSetShapeMaterialAtIndex()
should do the trick.Another potential issue would be that some shapes become entangled inside other shapes after the addition of the new voxels: This is not really an issue for me, it can already happen if you turn shaped static to move them and them make them dynamic again while they are colliding with something. So it's up to the modders to try and avoid this if they want to.
Describe alternatives you've considered
I have considered spawning new voxels as separate shapes using the new
Spawn()
function and somehow stick them to existing shapes... And how terrible of a solution that would be.Additional context
No response