Jump to content

SetColor


gamecreator
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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)

 

post-14-0-57980600-1483078393_thumb.jpg

  • Upvote 2

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...