Runtime Material Changing

mahdie9

22-09-2011 10:43:57

Hi all,

Is there any way to change the NxOgre::Material of a body during runtime?
For example, changing the material of the wheels of a car over different surfaces, and by not using terrains but just Plane?
I have these materials set:

NxOgre::MaterialDescription md;
md.mRestitution = 0.1f;
md.mStaticFriction = 1.2f;
md.mDynamicFriction = 0.85f;
md.mName = "Normal";
normal = critter->getScene()->createMaterial( md );

md.mRestitution = 0.1f;
md.mStaticFriction = 0.8f;
md.mDynamicFriction = 0.65f;
md.mName = "Rain";
rain = critter->getScene()->createMaterial( md );

md.mRestitution = 0.1f;
md.mStaticFriction = 0.5f;
md.mDynamicFriction = 0.3f;
md.mName = "Snow";
snow = critter->getScene()->createMaterial( md );

md.mRestitution = 0.1f;
md.mStaticFriction = 0.3f;
md.mDynamicFriction = 0.1f;
md.mName = "Ice";
ice = critter->getScene()->createMaterial( md );

and I want to use a runtime command to change the material among these ones.
Any comment?
Thanks