SetFarClipDistance: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Undo revision 69618 by DREFTHUN (talk))
Tag: Undo
 
(15 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{note box|Setting this less than 5 may cause problems to the client}}
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
This function is used to set the distance of render.
This function is used to set the distance of render. Areas beyond the specified distance will not be rendered.


==Syntax==
==Syntax==
Line 8: Line 7:
bool setFarClipDistance ( float distance )
bool setFarClipDistance ( float distance )
</syntaxhighlight>
</syntaxhighlight>
[[File:Far.png|thumb|example for function]]


===Required Arguments===  
===Required Arguments===  
*'''distance:''' A float specifying the distance of render.
*'''distance:''' A float specifying the distance of render. '''Setting this less than 5 will cause problems to the client.'''
 
===Returns===
===Returns===
Returns ''true'' if the distance was set correctly, ''false'' if invalid arguments were passed.
Returns ''true'' if the distance was set correctly, ''false'' if invalid arguments were passed.


==Example==
==Example==
<section name="Server" class="server" show="true">
<section name="Server" class="server" show="true">
The function which is adjusting visibility range of the game world.
This example adjusts the visibility range of the game world.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function onResourceStart(resource)
addEventHandler( "onResourceStart", resourceRoot,
setFarClipDistance(3000) -- we adjust visibility range on 3000 metres
function( )
end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),onResourceStart)
setFarClipDistance( 3000 ) -- We adjust visibility range to 3000 metres
end
)
</syntaxhighlight>
</section>
<section name="Client" class="client" show="false">
This example adjusts the visibility range of the game world.
<syntaxhighlight lang="lua">
addEventHandler( "onClientResourceStart", resourceRoot,
function( )
setFarClipDistance( 3000 ) -- We adjust visibility range to 3000 metres
end
)
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
Line 27: Line 51:
==See Also==
==See Also==
{{World functions}}
{{World functions}}
[[Category:Needs_Example]]

Latest revision as of 20:08, 15 March 2021

This function is used to set the distance of render. Areas beyond the specified distance will not be rendered.

Syntax

bool setFarClipDistance ( float distance )
example for function

Required Arguments

  • distance: A float specifying the distance of render. Setting this less than 5 will cause problems to the client.

Returns

Returns true if the distance was set correctly, false if invalid arguments were passed.








Example

Click to collapse [-]
Server

This example adjusts the visibility range of the game world.

addEventHandler( "onResourceStart", resourceRoot,
	function( )
		setFarClipDistance( 3000 ) -- We adjust visibility range to 3000 metres
	end
)
Click to expand [+]
Client

See Also