jo.entity.getEntityInCrosshair default flag 16 = vegetation only — pass -1 to hit peds
Context
Using jo.entity.getEntityInCrosshair(distance, flags, toIgnore) to raycast from camera and detect what the player is aiming at.
The trap
The autodoc shows flags defaults to 16. If you accept the default (or pass 16 explicitly), the raycast will completely skip peds and vehicles. The crosshair shows "hit" against the world geometry behind a ped, so you ignite the ground three meters past the target instead of the target itself.
16 in the underlying START_SHAPE_TEST_LOS_PROBE flagset is the vegetation/objects bucket — not peds.
The fix
Pass -1 (all flags) for "hit anything":
local hit, coords, entity = jo.entity.getEntityInCrosshair(60.0, -1, PlayerPedId())
If you want fine-grained control without water/foliage:
1= world/map4= ped 1 (excl. player)8= ped 2 (incl. player)16= objects/vegetation- Combo
1 | 4 | 8 | 16 = 29= world+peds+objects, no water
Verified
Built an aim-and-ignite mechanic. With default flag 16 the fire always landed behind any ped I aimed at. Switched to -1 and the crosshair started landing on peds, horses, vehicles, and props as expected.
Tags: raycast, crosshair, aim, flags, jo_libs, entity
Category: jo_libs
Source: ch-superman
Created: 2026-05-03T10:23:21.688Z