SetColor not working on ClientsideModel

hey guys,

heres a short example of what im trying to do.

[lua]local Veh = vgui.Create(“DModelPanel”);
// setpos and whatever

Veh.Entity:SetColor(Color(255, 0, 0));[/lua]

it doesnt error but it doesnt work either.

i was going over the code for the dmodelpanel and i think this might have something to do with
[lua]self.Entity = ClientsideModel( strModelName, RENDER_GROUP_OPAQUE_ENTITY )[/lua]
the render group part?

im not completely sure so any help would be much appreciated.

Try Color(255,0,0,255) with the last part being the alpha.

Color sets alpha to 255 if its not defined, but i tried it anyway and it still didnt work.

ill create a clientside model and see if it works.

ok i tried creating a client side model and i still cant set the color of it.

-bump- can anyone help?

[lua]Veh:SetColor(Color(255, 0, 0))[/lua]
instead of
[lua]Veh.Entity:SetColor(Color(255, 0, 0))[/lua]

iv tried that and it doesnt work either.

i created a ClientsideModel on its own and it doesnt work either.

have you tried Veh.Entity:SetColor(255, 0, 0, 255)

:0 not yet i thought it was removed and tool a color argument but ill run it now

[editline]20th July 2012[/editline]

didnt work D:

ShouldDrawLocalPlayer interrupts any color changing you do on clientsidemodels, are you using some thirdperson addon?

nope its vanilla gmod 13

Are you 100% sure this doesn’t work? Because it should. DModelPanel has a SetColor function which manually sets the color of its model before rendering it. Changing the color of a ClientsideModel will do nothing if you’re going to render it manually, which is pretty much what DModelPanel does.

Also try Color(255, 0, 0, 255) instead of Color(255, 0, 0). I think the alpha is set to 255 if you omit it anyway but you never know.

wow that solved the problem… lol thank you very much :smiley: iv had that problem for AGES!

i set the color of the model panel and not the entity and it works :slight_smile:

Thank Stillnex, he’s the one who came up with the solution first. :v:

hehe i could have sworn i tried it on the model panel…idk but thanks anyways to everyone