SiliconGhetto Engine API
    Preparing search index...

    Function voxelRaycast

    • Cast a ray from the camera into the voxel world to find which block the player is looking at.

      Parameters

      • maxDist: number = 7

        Maximum ray distance in blocks (default 7)

      Returns RaycastResult

      Raycast result with hit status, block position, adjacent position, and block type

      const ray = sg.voxelRaycast();
      if (ray.hit) { sg.setBlock(ray.x, ray.y, ray.z, sg.BLOCKS.AIR); }