gamecreator Posted December 30, 2016 Share Posted December 30, 2016 This is kind of random but any idea why SetColor would work on some models but not others? Is there a material setting requirement? With this code: Model* model = Model::Sphere(); model->SetPosition(-386.159, 35.252, 251.961); model->SetScale(0.1, 0.1, 0.1); model->SetColor(1, 0, 0, true); player.model->SetColor(1, 0, 0, true); rock[0].model->SetColor(1, 1, 0, true); rock[1].model->SetColor(1, 0, 0, true); rock[2].model->SetColor(1, 0, 1, true); rock[3].model->SetColor(1, 1, 1, true); the sphere and the player model turn red but the rocks in my scene don't change colors, though I can move them, hide them, whatever else. Not sure what the problem could be. Not a big deal but I was gonna change rock colors as a debug method when they're within laser range. Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 30, 2016 Share Posted December 30, 2016 Best guess is that the color is not being set via whichever shader is being applied to them. What shader is being applied to it? Is it the latest version of inherent LE shaders or is it a custom shader? Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
gamecreator Posted December 30, 2016 Author Share Posted December 30, 2016 Latest 4.2 LE shader. All it had on it was diffuse but now I've added normal and specular and also shadow. None of it changed anything. I've uploaded the rock here, if someone's curious: http://www.mediafire.com/file/p7xbdgq0bk9a1dw/rock.zip (It was free on Turbosquid.) Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 30, 2016 Share Posted December 30, 2016 The parent entity is not the object that has a surface. Since for some reason you prefer doing your own collision hull, the hull along with the actual rock model are children. So just set the recursive parameter to true in SetColor() for it to change. Granted you have to use the modified SetColor() command for it to work... self.entity:SetColor(1,0,0,1,Color.Diffuse,true) ^^I have no idea when the new parameter for Diffuse/Specular was inserted into this command. I didn't realize it until I got an error for trying to set the color with a Vec4 and true for recursive. Seems like that should be an option. Current options: Syntax void SetColor(float r, float g, float b, float a=1.0, int mode=Color::Diffuse, bool recursive=false) void SetColor(float r, float g, float b ) void SetColor(const Vec4& color, int mode=Color::Diffuse, bool recursive=false) Should also have two other added since its been the standard for almost 10 years prior: void SetColor(float r, float g, float b, bool recursive = false) void SetColor(const Vec4& color, bool recursive = false) I also wouldn't mind if these were allowed as well: void SetColor(const Vec3& color, bool recursive = false) void SetColor(float r, float g, float b, float a, bool recursive = false) void SetColor(float r, float g, float b, float a) 2 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
gamecreator Posted December 30, 2016 Author Share Posted December 30, 2016 Thank you! It worked. I did have it recursive but I didn't know the Color::Diffuse would be required for it. Appreciated! (I wonder if it might be a bug since SetColor(1, 0, 0, true) works on parent-only models.) Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 30, 2016 Share Posted December 30, 2016 (I wonder if it might be a bug since SetColor(1, 0, 0, true) works on parent-only models.) I get an error in the Beta's lua version if I try to do that. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.