Chaning colour of multiple shape components.

Typically: "How do I... ", "How can I... " questions
Post Reply
Posts: 2
Joined: 16 May 2020, 21:33

Chaning colour of multiple shape components.

Post by kp901 »

I've been having issues with changing the colour of multiple shape components. I've got several parts consisting of above 40 components and I would like to change their colour in a consistent way.

At the moment the model is not making any movement or actions, therefore it doesn't have any script, so I tried using the Lua code and I used the standard sim.setShapeColor and it does sort of work, but in a very plain, 2D way. All the shades and lighting are gone and the shape looks just poor because of that. Should any of the colorcomponents help with that? I've tried them all and none solved the issue.

Is it just the way this code works (or would one work just the same from the child script level?) to just give the entire shape the requested colour regardless of the angle or may it be because the shape is a convex decomposition of an irregular shape? I wouldn't think a convex shape would be a trouble to this matter, also that's the only way I am managing to keep the pieces together through joints (which I might've messed up, though, because at the moment the vehicle is turning around instead of going forward).

Any advice about the colour issue? Or even the joints not turning wheels forward and making the vehicle turn around instead?
Thank you.

Site Admin
Posts: 7928
Joined: 14 Dec 2012, 00:25

Re: Chaning colour of multiple shape components.

Post by coppelia »


sorry for the late reply. How exactly are you changing the color of the shapes with the function sim.setShapeColor? You should use the color component sim.colorcomponent_ambient_diffuse.


Post Reply