Revision Difference
util.DecalEx#568566
<function name="DecalEx" parent="util" type="libraryfunc">
<description>
Performs a trace and paints a decal to the surface hit.
<note>This function has trouble spanning across multiple brushes on the map.</note>
</description>
<realm>Client</realm>
<args>
<arg name="material" type="IMaterial">The name of the decal to paint. Can be retrieved with <page>util.DecalMaterial</page>.</arg>
<arg name="ent" type="Entity">The entity to apply the decal to</arg>
<arg name="position" type="Vector">The position of the decal.</arg>
<arg name="normal" type="Vector">The direction of the decal.</arg>
<arg name="color" type="Color">The color of the decal. Uses <page>Color</page>.
This only works when used on a brush model and only if the decal material has set `$vertexcolor` to `1`.</arg>
<arg name="w" type="number">The width scale of the decal.</arg>
<arg name="h" type="number">The height scale of the decal.</arg>
</args>
</function>
⤶
⤶
<example>⤶
<description>A clientside console command that creates a scaled red decal wherever the player executing it is looking at.</description>⤶
<code>⤶
concommand.Add("decalitup", function( ply )⤶
⤶
local mat = util.DecalMaterial( "Eye" )⤶
local tr = util.TraceLine({⤶
start = ply:GetShootPos(),⤶
endpos = ply:GetShootPos() + ply:GetAimVector() * 10000,⤶
filter = ply⤶
} )⤶
⤶
local ent = tr.Entity⤶
if ( !IsValid( ent ) ) then ent = game.GetWorld() end⤶
⤶
util.DecalEx( Material( mat), ent, tr.HitPos, tr.HitNormal, Color( 255, 0, 0, 255 ), 2, 1 )⤶
⤶
end )⤶
</code>⤶
</example>
Garry's Mod
Rust
Steamworks
Wiki Help