So I've got an entity of a blood, and I don't draw its model, it doesn't have any collisions either - It draws all nicely and everything, but I'd love to fade it out once it's lifetime runs out - I know the logic on how to do that, but I have no idea how I can alter the alpha to be drawn by math.QuadEasy
Here's the draw code for the mesh.
local BLOOD = Material( "vc_blood_pool.png", "smooth" )
local iScale = self:GetModelScale()
render.SetMaterial( BLOOD )
surface.SetDrawColor( 255,0,0, 150 )
mesh.Begin( MATERIAL_QUADS, 1 )
mesh.QuadEasy( self:GetPos() + Vector( 0, 0, 0.5 ), self:GetUp(), 10 * iScale, 10 * iScale )
I managed to draw a mesh on the ground and change the alpha. However it is a triangle. I've never worked with the mesh/render library, but I imagine you could create two triangles then set the uv to make it proper? Anyways, I tried a few things, couldn't get it. But hopefully this helps you in some way.
Here are my sources I was experimenting with:
Out of all the things that I have tried, mesh.Color is the one I haven't - I'll try it asap - it might be that QuadEasy function doesn't really let you change colors, but I'll check that now.
Solved it - QuadEasy doesn't work with alpha/color setting as it probably uses it internally anyways and overrides the set values - the solution was to just draw the quad manually and set the colour and alpha using mesh.Color.
Thanks @find me , you sent me on the right track.
Sorry, you need to Log In to post a reply to this thread.