Page 1 of 1

Can't get material

Posted: Thu Feb 04, 2021 12:23 am
by Rudy F
Hello
I am getting null when I cast IAppearance_DG to IMaterial using this code:

Code: Select all

	    IEntity_DG entity = iStdShape.Box(1, 1, 1);			//iStdShape is IStdShape
            IAppearance_DG apppearance = iEntity.GetAppearance();
            apppearance.SetColor(1.0f, 0, 0);    
            // Get material to modify specular color 
            IMaterial material = iAppBox as IMaterial;
Is there any problem with it?
Thank you

Re: Can't get material

Posted: Thu Feb 04, 2021 11:21 pm
by Prashant Kande
Hi Rudy

Get it from the entity: IMaterial material = entity as IMaterial;

It is a good point though. We will add handling the query in v6.2.

Thank you for reporting