UgLib.Raycast.FromCoords(from, to, options?) -> resultUgLib.Raycast.FromCamera(distance?, options?) -> result
integer
default:"511"
What the ray hits. 511 is everything.
integer
An entity to ignore. FromCamera ignores the local player by default.
table
{ hit, coords?, normal?, entity?, material? }. entity is nil for the world.
Shape tests are asynchronous: both MUST run in a thread and wait at most 1 second. FromCamera casts distance meters (default 10) from the gameplay camera.
Screen
UgLib.Screen.WorldToScreen(coords) -> onScreen, x, yUgLib.Screen.GetResolution() -> width, heightUgLib.Screen.GetAspectRatio() -> number
x and y go from 0 to 1.
Example
client.lua
CreateThread(function() local result = UgLib.Raycast.FromCamera(5.0) if result.hit and result.entity and IsEntityAVehicle(result.entity) then print('Looking at a vehicle') endend)