SetNearClipDistance

From Multi Theft Auto: Wiki
Revision as of 16:01, 27 November 2014 by AlexTMjugador (talk | contribs) (Documented the function added in r6948)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function sets the distance from the camera at which the world starts rendering. It can be used in many ways, including: reducing Z-fighting, creating more sophisticated first person views, allowing the camera to fly closer to the ground without passing through it, etcetera.


[[{{{image}}}|link=|]] Note: To avoid problems, the near clip distance should be smaller than the far clip distance. Also, setting very high near clip distances while the camera is near objects causes graphical artifacts.

Syntax

bool setNearClipDistance ( float distance )

Required arguments

  • distance: the new near clip distance. It must be between 0.1 and 20 for the function to do any effect. Default value is 0.3.

Returns

This function returns true if the argument is valid. Returns false otherwise.

Example

This example allows the camera to be nearer to ground level without viewing what is under it.

setNearClipDistance(0.1) -- Start rendering things three times nearer than usual to archieve the effect described above

See also