I have a mesh that I want to change the material setting on it with the press on a key.
I have this: where a key is pressed and it goes to the revertlaser
Here is from the mesh:
MATERIALS 17
material01
tread
material04
black
light
orange
grate
wheeld
red
dkgrey
panel
logo
logo1
wheele
wheelgrey
material02
laserbeam
MATERIAL material01
.909804 .909804 .909804 1
.909804 .909804 .909804 1
1 1 1 1 20
0 0 0 1
But I can not see the material change take effect
I have this: where a key is pressed and it goes to the revertlaser
Code:
MESHHANDLE tank = oapiLoadMeshGlobal ("LASER2");
case OAPI_KEY_W: // fire
{
Revertlaser();
return 1;
}
void LASER2::Revertlaser (void)
{
PlayVesselWave3(JohnSoundID,CANNON,NOLOOP,255);
MATERIAL *mat = oapiMeshMaterial (tank, 1); // first you point to the material.
mat->diffuse.a = 1; // then you change the alpha value to 0.025 on the diffuse line
mat->diffuse.g = 0.015686;
mat->diffuse.b = 0.694118;
mat->diffuse.r = 0.694118;
mat->ambient.a = 1; // then you change the alpha value to 0.025 on the diffuse line
mat->ambient.g = 0.015686;
mat->ambient.b = 0.694118;
mat->ambient.r = 0.694118; // 0.1 on ambient alpha
mat->specular.a = 1; // then you change the alpha value to 0.025 on the diffuse line
mat->specular.g = 1;
mat->specular.b = 1;
mat->specular.r = 1; // 0.1 on ambient alpha //etc..
mat->emissive.a = 1;
mat->emissive.g = 0.015686;
mat->emissive.b = 0.694118;
mat->emissive.r = 0.698039;
}
MATERIALS 17
material01
tread
material04
black
light
orange
grate
wheeld
red
dkgrey
panel
logo
logo1
wheele
wheelgrey
material02
laserbeam
MATERIAL material01
.909804 .909804 .909804 1
.909804 .909804 .909804 1
1 1 1 1 20
0 0 0 1
But I can not see the material change take effect
Last edited: