Garry's Mod Wiki

render.PushCustomClipPlane

  render.PushCustomClipPlane( Vector normal, number distance )

Description

Pushes a new clipping plane of the clip plane stack and sets it as active.

A max of 2 clip planes are supported on Linux/POSIX, and 6 on Windows.

Issue Tracker: 2687

Arguments

1 Vector normal
The normal of the clipping plane.
2 number distance
The distance of the plane from the world origin. You can use Vector:Dot between the normal and any point on the plane to find this.

Example

Clips the lower half of your custom entity

function ENT:Draw() local normal = self:GetUp() -- Everything "behind" this normal will be clipped local position = normal:Dot( self:GetPos() ) -- self:GetPos() is the origin of the clipping plane local oldEC = render.EnableClipping( true ) render.PushCustomClipPlane( normal, position ) self:DrawModel() render.PopCustomClipPlane() render.EnableClipping( oldEC ) end