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