cam.Start3D

From Garry's Mod
Jump to: navigation, search
 cam.Start3D( )

Contents

Description

Sets up a new 3D rendering context. Must be finished by cam.End3D.

For more advanced settings such as an orthographic view, use cam.Start instead.

NOTE

This is a function that starts a 3D rendering context.
This means that the only rendering functions will work after it are functions with a 3D rendering context.

BUG

Negative x/y values won't work.

Issue Tracker: #1995

BUG

This will not update current view properties.

Issue Tracker: #2682

Arguments

Vector pos=EyePos()

Render cam position.

Arguments

Angle angles=EyeAngles()

Render cam angles.

Arguments

number fov=nil

Field of view.

Arguments

number x=0

X coordinate of where to start the new view port.

Arguments

number y=0

Y coordinate of where to start the new view port.

Arguments

number w=ScrW()

Width of the new viewport.

Arguments

number h=ScrH()

Height of the new viewport.

Arguments

number zNear=nil

Distance to near clipping plane.

Arguments

number zFar=nil

Distance to far clipping plane.

Examples

Example

Set up a 3D rendering environment in a 2D rendering hook to render models on HUD.

hook.Add( "HUDPaint", "3d_camera_example", function()
	cam.Start3D()
		for id, ply in pairs( player.GetAll() ) do
			ply:DrawModel()
		end
	cam.End3D()
end )

Output:

All players can be seen through walls.
Personal tools
Navigation