LogoLogo
  • Get Started
  • Getting Started
    • Initial Setup
    • Create Your First Game
    • API Reference
    • Build Your First World Map
    • Multiplayer Testing
    • Use Templates & Examples
    • Styling & Assets
      • Modeling Guidelines
      • Texturing Guidelines
      • Default Assets
  • Build Faster With AI Tools
  • SDK Guides
    • Assets
    • Audio & SFX
      • Audio Manager
    • Blocks & Chunks
      • Block Types
      • Block Type Registry
      • Chunks
      • Chunk Lattice
    • Camera
    • Chat & Commands
    • Debugging
    • Entities
      • Animations
      • Block Entities
      • Colliders & Hitbox
      • Child Entities
      • Entity Controllers
        • Base Entity Controller
        • Pathfinding Entity Controller
        • DefaultPlayer Entity Controller
        • Simple Entity Controller
      • Entity Manager
      • Model Entities
      • Movement & Pathfinding
      • Player Controlled Entities
    • Events
    • Input & Controls
    • Lighting
      • Ambient Light
      • Light Manager
      • Point Lights
      • Spot Lights
      • Sun Light (Directional)
    • Mobile
    • Persisted Data
    • Players
      • Player Manager
      • Persisted Player Data
    • Plugins
    • Physics
      • Colliders
      • Collision Groups
      • Debugging
      • Gravity
      • Raycasts
      • Rigid Bodies
    • User Interface
      • Overlay UI
      • Scene UIs
      • Scene UI Manager
    • Worlds
      • Map Data Format
  • Helpful Resources
    • HYTOPIA Architecture & Platform Overview
    • Useful Third-Party Tools
Powered by GitBook
On this page
  • Debugging Colliders
  • Debugging Raycasts
Export as PDF
  1. SDK Guides
  2. Physics

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.

startServer(world => {
  world.simulation.enableDebugRendering(true);
  
  // ... other code
});

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.

startServer(world => {
  world.simulation.enableDebugRaycasting(true);
  
  // ... other code
});
PreviousCollision GroupsNextGravity

Last updated 4 months ago