setColor over part of a model [Solved]

I want to have a car in different colors. I have a car model where there is a car_body group that I can assign a texture without messing with tyres, glass and other car parts.

tex=loader.loadTexture("myCarColor01.png")
car.find('**/Car_body').setTexture(tex)

That’s ok and I can work just with that.

Since I like to make things the more simple it’s possible, I think it would be better just to setColor like this:
BLACK = Vec4(0,0,0,1)
WHITE = Vec4(1,1,1,1)

car.find('**/Car_body').setColor(BLACK)

But it doesn’t work, the car body looks uncolored and untextured (the rest of the car its fine)

Any help with this problem?

Try:

car.find('**/Car_body').setColor(BLACK, 1)

The second parameter is a priority override, and is necessary to override the implicit white color you already have on your vertices.

David

Wow, This was a fast reply :smiley: Well, in a first try the priority override didn’t change a thing, but it made me to think if maybe there was some material involved screwing the whole thing. Indeed it was, so when I removed it, it looked as expected.

Thanks one more time David, the Panda Forums magician.