CHAI3DCHAI3D

normal set color

More
06 Nov 2016 11:08 #1

hello!
I am using the 'my device' code and I'm creating a cylinder, but when I'm trying to rotate the object about its axis, I'm losing the option to change its color and it's becoming gray.


cylinder0 = new cShapeCylinder(rad, rad, height);
world->addChild(cylinder0);

// set position and orientation
cylinder0->setLocalPos(height/2,0.0, 0.0);
cylinder0->rotateAboutGlobalAxisDeg(cVector3d(0.0, 1.0, 0.0),90);

// set material color
cylinder0->m_material->setBlueCornflower();

// cylinder0->createEffectSurface();
cylinder0->setTransparencyLevel(0.5);


thanks a lot for the help!

Please Log in or Create an account to join the conversation.

More
07 Nov 2016 20:59 #2

I think its because of your direction of lighting. No light is reflected from the cylinder to the camera.
I am assuming that you have "light->setDir(-1.0, 0.0, 0.0)" in your code.

change your direction of your light source -- may be "light->setDir(1.0, 0.0, 0.0)" and see.

Hope this helps.

Please Log in or Create an account to join the conversation.

More
13 Nov 2016 09:41 #3

Thank you
It works!

Please Log in or Create an account to join the conversation.