Entity/SetRenderClipPlane

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=SetRenderClipPlane
+
|Description=Used to specify a plane, past which an object will be visually clipped.
|Parent=Entity
+
 
|Realm=Client
 
|Realm=Client
 
|IsClass=Yes
 
|IsClass=Yes
 +
|Name=SetRenderClipPlane
 +
|Parent=Entity
 
}}
 
}}
 
{{Arg
 
{{Arg
 
|type=Vector
 
|type=Vector
 +
|name=planeNormal
 +
|desc=The normal of the plane. Anything behind the normal will be clipped.
 
}}
 
}}
 
{{Arg
 
{{Arg
 
|type=number
 
|type=number
 +
|name=planePosition
 +
|desc=The position of the plane.
 +
}}
 +
{{Example
 +
|Description=Creates a blue barrel at Vector(0, 0, 0), freezes it, and will visually clip the barrel's lower half.
 +
|Code=local ent = ents.Create( "prop_physics" )
 +
ent:SetModel( "models/props_borealis/bluebarrel001.mdl" )
 +
ent:SetPos( Vector(0, 0, 0) )
 +
ent:Spawn()
 +
ent:GetPhysicsObject():EnableMotion(false)
 +
 +
local normal = ent:GetUp()
 +
local position = normal:Dot( ent:GetPos() )
 +
ent:SetRenderClipPlaneEnabled( true )
 +
ent:SetRenderClipPlane( normal, position )
 +
 
}}
 
}}

Latest revision as of 22:37, 6 November 2015

 Entity:SetRenderClipPlane( )

Contents

Description

Used to specify a plane, past which an object will be visually clipped.

Arguments

Vector planeNormal

The normal of the plane. Anything behind the normal will be clipped.

Arguments

number planePosition

The position of the plane.

Examples

Example

Creates a blue barrel at Vector(0, 0, 0), freezes it, and will visually clip the barrel's lower half.

local ent = ents.Create( "prop_physics" )
ent:SetModel( "models/props_borealis/bluebarrel001.mdl" )
ent:SetPos( Vector(0, 0, 0) )
ent:Spawn()
ent:GetPhysicsObject():EnableMotion(false)

local normal = ent:GetUp()
local position = normal:Dot( ent:GetPos() )
ent:SetRenderClipPlaneEnabled( true )
ent:SetRenderClipPlane( normal, position )


Personal tools
Navigation