• Question about materials.
    6 replies, posted
With the CreateMaterial function, you can make a material ignore the Z axis and be shown through walls. What I was wondering about this is there a way to have the color/material change depending if it's being obstructed? Say I have a material that's all red, is there a way to have parts of it be green if there is something in the way?
You would have to override the draw function for the entity to change it, and also do a raycast to see if its obstructed to the players eyes. ENTITY/Draw render.MaterialOverride render.ModelMaterialOverride util.TraceLine Entity/EyePos
That could do, but it would just turn the whole model a different color/material not just the bits blocked
http://wiki.garrysmod.com/page/render/MaterialOverrideByIndex Using that right will allow you to just change one model, but you will have to target the right index.
What if a material doesn't have an index? Even so say a person is the object, if just their hand or shirt is sticking out, it'd change their entire shirt
You are going to have to use stencils, something along the Let's make a wallhack part in this thread does something similiar if I remember correctly -> Time For You to Understand Stencils!
Bleh, complicated as usual, tis the way of gmod. Thanks!
Sorry, you need to Log In to post a reply to this thread.