hit

Contact information struct, normally set up by c_trace when SCAN_TEXTURE is set and USE_AABB is not set. The following parameters can be evaluated in lite-C code:

Parameters:

hit.v D3DVERTEX* pointer with interpolated coordinate values at the contact position.
hit.x,y,z Contact position, either on the bounding box, or on the hit polygon depending on whether USE_POLYGON was set.
hit.nx,ny,nz Contact surface normal.
hit.u1,v1 First texture coordinates of the contact position, in pixels. A7.20
hit.u2,v2 Second texture (lightmap) coordinates of the contact position, in pixels. A7.20
hit.blue,green,red Pixel color of the second texture (f.i. a lightmap) at the contact position, for 24-bit textures only.
hit.vertex Vertex number closest to the contact. Can also be used to determine the hit limb of a bones animated model through the ent_bonename function.
hit.triangle Surface number of the contact.
hit.chunk Mesh number in case of multi-mesh entities, such as level meshes or chunked terrain.
hit.subset Number of the hit skin subset of a model, starting with 0. Can be used to determine which part of the mesh was hit, or for removing the mesh part through the vmask parameter. A7.80
hit.flags Flags 9 or 10 are set when something was hit; can be evaluated in lite-C by if (HIT_TARGET) ... (see example).
hit.model Internal mesh information.
hit.entity ENTITY* pointer, or NULL when a level surface was hit.
hit.skin1,skin2 BMAP* pointers of the first and second texture of the hit surface. Can be used to determine the pixel color or alpha value at the contact position.
hit.texname char* pointer, name of the hit texture (skin1 or skin2) for models, blocks, or sprites. Terrain has no texture names.

Type:

CONTACT* (defined in atypes.h)

Modified by:

c_trace, c_move, ent_create, level_load, wait

Example:

See ent_decal

See also:

c_trace, c_move, normal, bounce

► latest version online