Garry's Mod Wiki

cam.Start3D

cam.Start3D( Vector pos = EyePos(), Angle angles = EyeAngles(), number fov = nil, number x = 0, number y = 0, number w = ScrW(), number h = ScrH(), number zNear = nil, number zFar = nil )

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.

This is a rendering function that requires a 3d rendering context.

This means that it will only work in 3d Rendering Hooks.

Negative x/y values won't work.
This will not update current view properties.

Arguments

1 Vector pos = EyePos()
Render cam position.
2 Angle angles = EyeAngles()
Render cam angles.
3 number fov = nil
Field of view.
4 number x = 0
X coordinate of where to start the new view port.
5 number y = 0
Y coordinate of where to start the new view port.
6 number w = ScrW()
Width of the new viewport.
7 number h = ScrH()
Height of the new viewport.
8 number zNear = nil
Distance to near clipping plane.
9 number zFar = nil
Distance to far clipping plane.

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.

Page Links


Special Pages


Wikis

?

Render Time: 62ms

Session 0
DB GetPage 2
Generate Html 37
SaveChanges 8
Render Body 0
Render Sidebar 12