Xonotic
vehicles.qc
Go to the documentation of this file.
1 #include "vehicles.qh"
2 
3 #ifdef GAMEQC
4 float vehicle_altitude(entity this, float amax)
5 {
6  tracebox(this.origin, this.mins, this.maxs, this.origin - ('0 0 1' * amax), MOVE_WORLDONLY, this);
7  return vlen(this.origin - trace_endpos);
8 }
9 
10 vector vehicles_force_fromtag_hover(entity this, string tag_name, float spring_length, float max_power)
11 {
12  force_fromtag_origin = gettaginfo(this, gettagindex(this, tag_name));
14  traceline(force_fromtag_origin, force_fromtag_origin - (v_forward * spring_length), MOVE_NORMAL, this);
15 
16  force_fromtag_power = (1 - trace_fraction) * max_power;
17  force_fromtag_normpower = force_fromtag_power / max_power;
18 
19  return v_forward * force_fromtag_power;
20 }
21 
22 vector vehicles_force_fromtag_maglev(entity this, string tag_name, float spring_length, float max_power)
23 {
24  force_fromtag_origin = gettaginfo(this, gettagindex(this, tag_name));
26  traceline(force_fromtag_origin, force_fromtag_origin - (v_forward * spring_length), MOVE_NORMAL, this);
27 
28  // TODO - this may NOT be compatible with wall/celing movement, unhardcode 0.25 (engine count multiplier)
29  if(trace_fraction == 1.0)
30  {
31  force_fromtag_normpower = -0.25;
32  return '0 0 -200';
33  }
34 
35  force_fromtag_power = ((1 - trace_fraction) - trace_fraction) * max_power;
36  force_fromtag_normpower = force_fromtag_power / max_power;
37 
38  return v_forward * force_fromtag_power;
39 }
40 #endif
entity() spawn
const float MOVE_NORMAL
Definition: csprogsdefs.qc:252
vector maxs
Definition: csprogsdefs.qc:113
origin
Definition: ent_cs.qc:114
#define gettaginfo
Definition: post.qh:32
#define gettagindex
Definition: dpextensions.qh:16
vector mins
Definition: csprogsdefs.qc:113
vector trace_endpos
Definition: csprogsdefs.qc:37
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float MOVE_WORLDONLY
float trace_fraction
Definition: csprogsdefs.qc:36
vector v_forward
Definition: csprogsdefs.qc:31