Xonotic
movelib.qc File Reference
#include "movelib.qh"
+ Include dependency graph for movelib.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void movelib_groundalign4point (entity this, float spring_length, float spring_up, float blendrate, float _max)
 

Function Documentation

◆ movelib_groundalign4point()

void movelib_groundalign4point ( entity  this,
float  spring_length,
float  spring_up,
float  blendrate,
float  _max 
)

Definition at line 185 of file movelib.qc.

References absmax, absmin, angles, maxs, MOVE_NORMAL, origin, setorigin(), trace_endpos, trace_fraction, v_forward, v_right, v_up, and vector().

186 {
187  vector a, b, c, d, e, r, push_angle, ahead, side;
188 
189  push_angle.y = 0;
190  r = (this.absmax + this.absmin) * 0.5 + (v_up * spring_up);
191  e = v_up * spring_length;
192 
193  // Put springs slightly inside bbox
194  ahead = v_forward * (this.maxs.x * 0.8);
195  side = v_right * (this.maxs.y * 0.8);
196 
197  a = r + ahead + side;
198  b = r + ahead - side;
199  c = r - ahead + side;
200  d = r - ahead - side;
201 
202  traceline(a, a - e,MOVE_NORMAL,this);
203  a.z = (1 - trace_fraction);
204  r = trace_endpos;
205 
206  traceline(b, b - e,MOVE_NORMAL,this);
207  b.z = (1 - trace_fraction);
208  r += trace_endpos;
209 
210  traceline(c, c - e,MOVE_NORMAL,this);
211  c.z = (1 - trace_fraction);
212  r += trace_endpos;
213 
214  traceline(d, d - e,MOVE_NORMAL,this);
215  d.z = (1 - trace_fraction);
216  r += trace_endpos;
217 
218  a.x = r.z;
219  r = this.origin;
220  r.z = r.z;
221 
222  push_angle.x = (a.z - c.z) * _max;
223  push_angle.x += (b.z - d.z) * _max;
224 
225  push_angle.z = (b.z - a.z) * _max;
226  push_angle.z += (d.z - c.z) * _max;
227 
228  //this.angles_x += push_angle_x * 0.95;
229  //this.angles_z += push_angle_z * 0.95;
230 
231  this.angles_x = ((1-blendrate) * this.angles.x) + (push_angle.x * blendrate);
232  this.angles_z = ((1-blendrate) * this.angles.z) + (push_angle.z * blendrate);
233 
234  //a = this.origin;
235  setorigin(this, r);
236 }
const float MOVE_NORMAL
Definition: csprogsdefs.qc:252
vector maxs
Definition: csprogsdefs.qc:113
origin
Definition: ent_cs.qc:114
vector absmax
Definition: csprogsdefs.qc:92
vector v_up
Definition: csprogsdefs.qc:31
vector trace_endpos
Definition: csprogsdefs.qc:37
vector(float skel, float bonenum) _skel_get_boneabs_hidden
vector v_right
Definition: csprogsdefs.qc:31
setorigin(ent, v)
vector angles
Definition: csprogsdefs.qc:104
vector absmin
Definition: csprogsdefs.qc:92
float trace_fraction
Definition: csprogsdefs.qc:36
vector v_forward
Definition: csprogsdefs.qc:31
+ Here is the call graph for this function: