Oh, I assumed it was a special function since there was something to do with weaponImage::onHitObject.
In that case, it'd be instant hitting at range and possibly not affected by your speed (without trigonometry, vectors etc. to see how far off it should be), do a raycast with either $TypeMasks::FxBrickAlwaysObjectType (all kinds of bricks but scans through players, statics, etc.) or $TypeMasks::All (every object).
You might want to use the showBricks field (I think, it's something similar) in the weapon image to make it show brick outlines as well.