DP MOVETYPEFOLLOW

From Quake Wiki

.movetype definitions:

float MOVETYPE_FOLLOW = 12;

MOVETYPE_FOLLOW implemented, this uses existing entity fields in unusual ways:

  • aiment - the entity this is attached to.
  • punchangle - the original angles when the follow began.
  • view_ofs - the relative origin (note that this is un-rotated by punchangle, and that is actually the only purpose of punchangle).
  • v_angle - the relative angles.

Here's an example of how you would set a bullet hole sprite to follow a bmodel it was created on, even if the bmodel rotates:

hole.movetype = MOVETYPE_FOLLOW; // make the hole follow
hole.solid = SOLID_NOT;          // MOVETYPE_FOLLOW is always non-solid
hole.aiment = bmodel;            // make the hole follow bmodel
hole.punchangle = bmodel.angles; // the original angles of bmodel
hole.view_ofs = hole.origin - bmodel.origin; // relative origin
hole.v_angle = hole.angles - bmodel.angles;  // relative angles