c_setminmax (ENTITY*)
Sets the collision ellipsiod and bounding box coordinates
of the entity to it's real proportions
(a bounding box around all it's frames)
, and sets both the entities'
FAT and NARROW flags.
Parameters:
ENTITY* - entity pointer.
Modifies:
min_xyz, max_xyz,
FAT / NARROW
Remarks:
- When a model is first loaded, its bounding
box values
are set to the fat or narrow standard hull by default, depending on the model's
size. Use c_setminmax
to set the bounding box coordinates to the real size if the entity is not
an actor.
- The bounding box can be changed during runtime, but care must be taken to
not extend it into other obstacles while doing so.
- c_setminmax uses the vertex
positions of all frames
of the model. To use extents from a different frame n only,
call c_updatehull(my,n) instead.
While
c_setminmax is essentially free (very little time required
to update the hull size), c_updatehull can take some
time to execute because it needs to reload the vertices of
the specified frame. Thus you should not call c_updatehull every
single frame but only for major animation changes (such as a standing character
who now kneels).
-
For bones animated models, c_setminmax only uses the original vertex positions. It does not calculate the animated positions. You can give an enlarged bounding box in the model editor by placing dummy vertices that are not connected to the mesh.
-
For manually setting the bounding box, set both the FAT/NARROW flags and set the min_x, max_x vectors directly. For scaling the bounding box, call c_setminmax first, then apply vec_scale to the the min_x, max_x vectors.
Speed:
Fast
Example:
action myaction()
{
vec_scale(my.scale_x,0.5); // scale entity to small size
c_setminmax(me); // set my bounding box to my real size
...
See also:
min_x, max_x, c_updatehull,
FAT, NARROW, collision
► latest
version online