Debugging
Oftentimes you'll need to visualize your colliders and raycasts to debug your game. The HYTOPIA SDK provides a few ways to do this.
Debugging Colliders
When you need to visualize colliders or sensor colliders, you can enable debug rendering for your game.
Debug rendering in its current implementation is very performance intensive because it streams all vertices and indices representing the internal physics simulation to all connected clients each tick. Because of this, you'll want to keep debug rendering off unless you need to briefly use it.
You can enable debug rendering as follows.
Debugging Raycasts
If you're using world.simulation.raycast()
, you'll almost always want to be able to visualize your raycasts while building and debugging your game. Raycasts, unlike colliders, do not impact performance to render them. You can keep raycast debugging enabled throughout your entire development cycle without any noticable performance impact.
Debug visualization of raycasts will create line in the game that is either black or red. A black line means no object was hit, a red line means an object was hit. Additionally, the line will have a 3D arrow indicating the direction of the raycast.
You can enable debug visualization of raycasts as follows.
Last updated