Voxel Play Behaviour

Modified on Thu, 25 Mar 2021 at 10:47 AM

Voxel Play Behaviour is an optional component that you can add to your gameobjects - it provides some useful interactivity with Voxel Play environment:



Tip: you can add Voxel Play Behaviour script to your prefabs or at runtime by using <your_game_object>.AddComponent<VoxelPlayBehaviour>();


Voxel Play Behaviour currently exposes the following options:



Enable Voxel Light:

When enabled, it will apply current voxel light intensity at the position to the object material. For example, if the object is spawned in a cave, it's important that the color reflects the actual light in the cave (also referred as global illumination). This global illumination is computed by Voxel Play automatically as it creates or updates the chunks of the world and this option reads that value and modifies the color intensity of the material accordingly.


Use Voxel Play Materials:

When enabled, the Voxel Play Behaviour script will replace any material in the object with compatible Voxel Play materials which are more optimized for the Voxel Play lighting.


Material recommendations:

To fully leverage GI, it's recommended to use either the VP Model VertexLit or VP Model Texture materials found in Voxel Play/Resources/VoxelPlay/Materials folder. These materials use optimized shaders to work with Voxel Play. However if you prefer to use your own materials, just disable the "Use Voxel Play Materials" . If you don't want to use GI in your game just disable the "Use Global Illumination" checkbox in Voxel Play Environment component.


Force Unstuck:

When enabled it will check if there's a solid voxel at the object position and move the gameobject to the surface.


Chunk Area:

When enabled it ensures the chunks around the object are fully generated (and optionally rendered). This is useful if you have enemies or other objects that need to interact with Voxel Play environment but are far from the camera (thus not visible).

Extents: define the bounds in chunk units (note that 1 chunk = 16 world units)

Render Chunks: if enabled, chunks within the bounds will also be rendered (the mesh, collider and NavMesh will be generated according to the general options)


Use Origin Shift:

if the Origin Shift is enabled in Voxel Play Environment and this option is used (enabled by default), the object position will be shifted when an origin shift occurs. This option should be left enabled.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article