GetWorldFromScreenPosition: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 19: | Line 19: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function explosion ( key, keyState ) | function explosion ( key, keyState ) | ||
local x, y, z = getWorldFromScreenPosition ( | local x, y, z = getWorldFromScreenPosition ( 0.5, 0.5 ) | ||
createExplosion ( x, y, z, 11 ) | createExplosion ( x, y, z, 11 ) | ||
end | end |
Revision as of 12:33, 11 August 2007
This function allows you to retrieve the world position corresponding to the 2D position on the screen.
Syntax
float float float getWorldFromScreenPosition ( float x, float y )
Required Arguments
- x: A float value between 0 and 1 indicating the x position on the screen.
- y: A float value between 0 and 1 indicating the y position on the screen.
Returns
Returns three floats indicating the world position, x, y and z respectively, false otherwise.
Example
This example binds the local player's "i" key to a function that creates an explosion in the middle of the screen.
function explosion ( key, keyState ) local x, y, z = getWorldFromScreenPosition ( 0.5, 0.5 ) createExplosion ( x, y, z, 11 ) end bindKey ( "i", "down", "create explosion", explosion )
See Also
- createSWATRope
- getBirdsEnabled
- getCoronaReflectionsEnabled
- getGarageBoundingBox
- getGaragePosition
- getGarageSize
- getGroundPosition
- getInteriorFurnitureEnabled
- getNearClipDistance
- getPedsLODDistance
- getRoofPosition
- getScreenFromWorldPosition
- getVehiclesLODDistance
- getWorldFromScreenPosition
- isAmbientSoundEnabled
- isLineOfSightClear
- isWorldSoundEnabled
- processLineOfSight
- resetAmbientSounds
- resetBlurLevel
- resetColorFilter
- resetCoronaReflectionsEnabled
- resetNearClipDistance
- resetPedsLODDistance
- resetVehiclesLODDistance
- resetWorldSounds
- setAmbientSoundEnabled
- setBirdsEnabled
- setColorFilter
- setCoronaReflectionsEnabled
- setInteriorFurnitureEnabled
- setInteriorSoundsEnabled
- setNearClipDistance
- setPedsLODDistance
- setVehiclesLODDistance
- setWorldSoundEnabled
- testLineAgainstWater
- areTrafficLightsLocked
- getAircraftMaxHeight
- getAircraftMaxVelocity
- getCloudsEnabled
- getFarClipDistance
- getFogDistance
- getGameSpeed
- getGravity
- getHeatHaze
- getInteriorSoundsEnabled
- getJetpackMaxHeight
- getMinuteDuration
- getMoonSize
- getOcclusionsEnabled
- getRainLevel
- getSunColor
- getSunSize
- getTime
- getTrafficLightState
- getWeather
- getWindVelocity
- getSkyGradient
- getPlayerBlurLevel
- getZoneName
- isGarageOpen
- removeWorldModel
- resetFarClipDistance
- resetFogDistance
- resetHeatHaze
- resetMoonSize
- resetRainLevel
- resetSkyGradient
- resetSunColor
- resetSunSize
- resetWindVelocity
- restoreAllWorldModels
- restoreWorldModel
- setAircraftMaxHeight
- setAircraftMaxVelocity
- setCloudsEnabled
- setFarClipDistance
- setFogDistance
- setGameSpeed
- setGarageOpen
- setGravity
- setHeatHaze
- setInteriorSoundsEnabled
- setMinuteDuration
- setMoonSize
- setOcclusionsEnabled
- setRainLevel
- setSkyGradient
- setSunColor
- setSunSize
- setTime
- setTrafficLightState
- setTrafficLightsLocked
- setWeather
- setWeatherBlended
- setWindVelocity
- setJetpackMaxHeight
- setPlayerBlurLevel