testLineAgainstWater
Client-side
Server-side
Shared
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function checks to see if a line between two points collides with the water. This is similar to processLineOfSight, but only collides with water. Waves are not taken into account when testing the line.
Syntax
bool float float float testLineAgainstWater ( float startX, float startY, float startZ, float endX, float endY, float endZ )Required Arguments
- startX: MISSING_PARAM_DESC
- startY: MISSING_PARAM_DESC
- startZ: MISSING_PARAM_DESC
- endX: MISSING_PARAM_DESC
- endY: MISSING_PARAM_DESC
- endZ: MISSING_PARAM_DESC
Returns
- bool float float float: value
Returns true and the position of the intersection point of the line and the water surface if there is a collision, or false if there is no collision.
Code Examples
shared
This code snippet adds a /isanywaterbelowme command, which checks if there is water at 500 units below the ground at the position of the player who types it.
function checkForWater() if isPedOnGround(localPlayer) then local px, py, pz = getElementPosition(localPlayer) if testLineAgainstWater(px, py, pz, px, py, pz - 500) then outputChatBox("Yes, there is water below you.") else outputChatBox("This place looks a bit dry.") end endendaddCommandHandler("isanywaterbelowme", checkForWater)See Also
World Functions
- areTrafficLightsLocked
- createSWATRope
- getAircraftMaxHeight
- getAircraftMaxVelocity
- getBirdsEnabled
- getCloudsEnabled
- getColorFilter
- getCoronaReflectionsEnabled
- getFarClipDistance
- getFogDistance
- getGameSpeed
- getGarageBoundingBox
- getGaragePosition
- getGarageSize
- getGravity
- getGroundPosition
- getHeatHaze
- getInteriorFurnitureEnabled
- getInteriorSoundsEnabled
- getJetpackMaxHeight
- getJetpackWeaponEnabled
- getMinuteDuration
- getMoonSize
- getNearClipDistance
- getOcclusionsEnabled
- getPedsLODDistance
- getRainLevel
- getRoofPosition
- getScreenFromWorldPosition
- getSkyGradient
- getSunColor
- getSunSize
- getTime
- getTrafficLightState
- getVehiclesLODDistance
- getWeather
- getWindVelocity
- getWorldFromScreenPosition
- getWorldProperty
- getZoneName
- isAmbientSoundEnabled
- isGarageOpen
- isLineOfSightClear
- isTimeFrozen
- isVolumetricShadowsEnabled
- isWorldSoundEnabled
- isWorldSpecialPropertyEnabled
- processLineAgainstMesh
- processLineOfSight
- removeGameWorld
- removeWorldModel
- resetAmbientSounds
- resetBlurLevel
- resetColorFilter
- resetCoronaReflectionsEnabled
- resetFarClipDistance
- resetFogDistance
- resetHeatHaze
- resetMoonSize
- resetNearClipDistance
- resetPedsLODDistance
- resetRainLevel
- resetSkyGradient
- resetSunColor
- resetSunSize
- resetTimeFrozen
- resetVehiclesLODDistance
- resetVolumetricShadows
- resetWindVelocity
- resetWorldProperties
- resetWorldProperty
- resetWorldSounds
- restoreAllWorldModels
- restoreGameWorld
- restoreWorldModel
- setAircraftMaxHeight
- setAircraftMaxVelocity
- setAmbientSoundEnabled
- setBirdsEnabled
- setCloudsEnabled
- setColorFilter
- setCoronaReflectionsEnabled
- setFarClipDistance
- setFogDistance
- setGameSpeed
- setGarageOpen
- setGrainLevel
- setGrainMultiplier
- setGravity
- setHeatHaze
- setInteriorFurnitureEnabled
- setInteriorSoundsEnabled
- setJetpackMaxHeight
- setJetpackWeaponEnabled
- setMinuteDuration
- setMoonSize
- setNearClipDistance
- setOcclusionsEnabled
- setPedsLODDistance
- setRainLevel
- setSkyGradient
- setSunColor
- setSunSize
- setTime
- setTimeFrozen
- setTrafficLightsLocked
- setTrafficLightState
- setVehiclesLODDistance
- setVolumetricShadowsEnabled
- setWeather
- setWeatherBlended
- setWindVelocity
- setWorldProperty
- setWorldSoundEnabled
- setWorldSpecialPropertyEnabled
- testLineAgainstWater
- testSphereAgainstWorld