]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/physics/movelib.qh
Merge branch 'master' into Mario/hagar_notfixed
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / physics / movelib.qh
1 #ifndef MOVELIB_H
2 #define MOVELIB_H
3
4 #ifdef SVQC
5 .vector moveto;
6
7 /**
8     Simulate drag
9     self.velocity = movelib_dragvec(self.velocity,0.02,0.5);
10 **/
11 vector movelib_dragvec(float drag, float exp_);
12
13 /**
14     Simulate drag
15     self.velocity *= movelib_dragflt(somespeed,0.01,0.7);
16 **/
17 float movelib_dragflt(float fspeed,float drag,float exp_);
18
19 /**
20     Do a inertia simulation based on velocity.
21     Basicaly, this allows you to simulate loss of steering with higher speed.
22     self.velocity = movelib_inertmove_byspeed(self.velocity,newvel,1000,0.1,0.9);
23 **/
24 vector movelib_inertmove_byspeed(vector vel_new, float vel_max,float newmin,float oldmax);
25
26 vector movelib_inertmove(vector new_vel,float new_bias);
27
28 .float  movelib_lastupdate;
29 void movelib_move(vector force,float max_velocity,float drag,float theMass,float breakforce);
30
31 /*
32 void movelib_move_simple(vector newdir,float velo,float blendrate)
33 {
34     self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo;
35 }
36 */
37 #define movelib_move_simple(e,newdir,velo,blendrate) \
38     e.velocity = e.velocity * (1 - blendrate) + (newdir * blendrate) * velo
39
40 #define movelib_move_simple_gravity(e,newdir,velo,blendrate) \
41     if(IS_ONGROUND(e)) movelib_move_simple(e,newdir,velo,blendrate)
42
43 void movelib_brake_simple(entity this, float force);
44
45 /**
46 Pitches and rolls the entity to match the gound.
47 Yed need to set v_up and v_forward (generally by calling makevectors) before calling this.
48 **/
49 #endif
50
51 void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max);
52
53 #endif