Navmesh & Collision
When you use a Generate Marching Cube Surface node, collision will be computed on visible chunks. This can be disabled by switching the Body Instance pin's value to No Collision. In order to customize this (or any) value's complex defaults, a Make Value node can be plugged into it, or a parameter can be created for and plugged into it. In either of those cases, the value can then be adjusted in that node's details panel.
![](https://docs.voxelplugin.com/~gitbook/image?url=https%3A%2F%2F990696062-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmS8hlCEu5n2GkaklxOpP%252Fuploads%252FfEBtsNuMGipqydLHTuTQ%252Fimage.png%3Falt%3Dmedia%26token%3D85f618ff-ee95-4793-95bb-c7ab61fc91b0&width=768&dpr=4&quality=100&sign=67be7702&sv=1)
Visible chunks being used as a source for collision means collision will have lower resolution as the terrain is farther from the camera. This can be undesirable when have NPCs or other colliding or simulated bodies moving around the map.
This can be addressed using Voxel Invokers. These components can be added to actors to cause them to generate collision (or navmesh) around themselves.
1. Using invokers
Generation is controlled by Box Invoker and Sphere Invoker components attached to actors:
These invokers can be moved, rotated and scaled as needed.
In order to make a graph actually generate colliders and navmesh data around an invoker, add a Generate Marching Cube Collision & Navmesh node.
In order for Navmesh generation to function properly, make sure that navmesh generation is set to Dynamic in the project settings.
2. Debugging collision & navigation
By default, no collision is generated in the editor. You can use voxel.collision.EnableInEditor 1
in the console to enable collision generation in the editor.
Once this is done, you should be able to see colliders generated when switching the viewport to the Player Collision view:
To debug navmesh in the editor, call voxel.navigation.EnableInEditor 1
in the console.
3. Multiplayer logic
Usually, you want to have different behavior on clients & servers. To do so, the plugin let you access the current net mode in the graph.
A typical setup could be:
Last updated