]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/physics/movetypes/follow.qc
Merge branch 'master' into terencehill/hud_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / physics / movetypes / follow.qc
1 #include "follow.qh"
2 void _Movetype_Physics_Follow(entity this) // SV_Physics_Follow
3 {
4         entity e = this.aiment;
5
6         if(e.angles == this.punchangle)
7         {
8                 this.origin = e.origin + this.view_ofs;
9         }
10         else
11         {
12                 vector ang, v;
13                 ang_x = -this.punchangle_x;
14                 ang_y = this.punchangle_y;
15                 ang_z = this.punchangle_z;
16                 makevectors(ang);
17                 v_x = this.view_ofs_x * v_forward_x + this.view_ofs_y * v_right_x + this.view_ofs_z * v_up_x;
18                 v_y = this.view_ofs_x * v_forward_y + this.view_ofs_y * v_right_y + this.view_ofs_z * v_up_y;
19                 v_z = this.view_ofs_x * v_forward_z + this.view_ofs_y * v_right_z + this.view_ofs_z * v_up_z;
20                 ang = e.angles;
21                 ang_x = -e.angles_x;
22                 makevectors(ang);
23                 this.origin_x = v_x * v_forward_x + v_y * v_forward_y + v_z * v_forward_z + e.origin_x;
24                 this.origin_x = v_x * v_right_x + v_y * v_right_y + v_z * v_right_z + e.origin_y;
25                 this.origin_x = v_x * v_up_x + v_y * v_up_y + v_z * v_up_z + e.origin_z;
26         }
27
28         this.angles = e.angles + this.v_angle;
29         _Movetype_LinkEdict(this, false);
30 }