processLineOfSight
Cliente
Lanza un rayo entre dos puntos y devuelve lo primero que toca.
bool, vec3, vec3, element|nil processLineOfSight(float startX, startY, startZ, float endX, endY, endZ [, bool checkBuildings = true, bool checkVehicles = true, bool checkPeds = true, bool checkObjects = true])
Parámetros
| Nombre | Tipo | Descripción |
|---|---|---|
| startX, startY, startZ | float | Donde empieza el rayo. También acepta un vec3. |
| endX, endY, endZ | float | Donde termina el rayo. También acepta un vec3. |
| checkBuildings | bool | Si cuentan los edificios.por defecto true |
| checkVehicles | bool | Si cuentan los vehículos.por defecto true |
| checkPeds | bool | Si cuentan los peds.por defecto true |
| checkObjects | bool | Si cuentan los objetos.por defecto true |
Retorno
false si no tocó nada. Si tocó algo, true, el punto tocado, la normal de la superficie en ese punto y el elemento tocado (nil cuando no es un elemento, como un edificio del mapa).
Ejemplo
local function firstHit(from, to)
local hit, position, normal, element = processLineOfSight(from, to, true, true, false, true)
if hit and element then
outputDebugString("Hit a " .. getElementType(element))
end
return hit and position
end