Runtime SetVoxelAtArrayPosition recommended workarounds for requiring voxels to already be there?

0
abunner posted this 14 February 2016

After some experimenting (and finding this Trello TODO... https://trello.com/c/zCeEtJ32/133-add-voxels-to-empty-volume) it seems I need some workaround to start with an empty volume and then fill it myself at runtime.

Is the recommended workaround to start with a filled volume, clear it out before the first frame (set everything to inactive?) and then fill it in with the voxels I want?

1 Comments
Order By: Standard | Newest | Votes
0
GarethIW posted this 14 February 2016

The absolute best way to do this would be to create your own prefab of a volume that is the size you want, with no voxels filled in. That way all you have to do is instantiate it and start filling it with your voxels.

If all you want to do is clear an existing volume, the quickest way is to create a new voxel array:

volume.GetCurrentFrame().Voxels = new Voxel[volume.XSize * volume.YSize * volume.ZSize];

Also, the thread below this one covers resizing an instantiated volume if that is of any use as well.


Our 125 members have posted 459 times in 111 discussions