vmask
This bit mask can be used to set certain model mesh groups invisible.
Set bit 0 for suppressing the first mesh group that uses a dedicated skin, bit 1 for the second mesh group and so on.
A7.80 LC
Type:
long
Remarks:
- When a mesh group is hit by c_trace, its group number is stored in the hit struct. The (1<<hit.subset) expression determines the bit belonging to that mesh group.
- Mesh groups must use a dedicated skin for being affected by the vmask parameter.
When you need several mesh groups with the same texture, create a new skin for each but select Shared Texture under Skin Settings.
Example:
// shoot at a mesh and remove the hit part
function mesh_removing_gun()
{
while (1)
{
VECTOR trace_target;
vec_set(trace_target,vector(5000,0,0)); // the weapon has a firing range of 5000 quants
vec_rotate(trace_target, camera.pan);
vec_add(trace_target, camera.x);
// display a red laser spot at the target position
if (c_trace(camera.x,trace_target, IGNORE_PASSABLE | USE_POLYGON| SCAN_TEXTURE) > 0) // hit something?
draw_point3d(hit.x,vector(50,50,255),100,3);
// fire and remove the hit mesh group
if (key_ctrl || joy_1) // fire
{
if (HIT_TARGET) // target hit?
your.vmask |= 1<<hit.subset; // make mesh group invisible
snd_play(sndShot,100,0); // play the shot sound
wait(-0.5); // reload
}
wait(1);
}
}
See also:
hit
► latest
version online