Expose the focus ray to Lua

The upcoming, proposed GPU renderer tests needed Lua to inspect the engine's crosshair result, and nearby.castRenderingRay would cast a second ray that could disagree. Since World::getFocusObject already runs each frame, this caches its result as read-only camera.getFocusRay().

Crosshair, telekinesis and GUI queries update the cache. An out-of-reach target can keep hit while losing hitObject. mHit defaults to false; World::clear drops cached objects across loads. Arbitrary rays remain in nearby.

IMO the getter belongs to camera because focus is player state; nearby is available to local scripts.

An integration test places an NPC under the crosshair and removes it after failures.

Edited by Thomas Portal

Merge request reports

Loading
Loading