3 self.velocity = movelib_vdrag(self.velocity,0.02,0.5);
\r
5 vector movelib_drag(float drag, float exp)
\r
9 lspeed = vlen(self.velocity);
\r
10 ldrag = lspeed * drag;
\r
11 ldrag = ldrag * drag * exp;
\r
12 ldrag = 1 - (ldrag / lspeed);
\r
14 return self.velocity * ldrag;
\r
19 self.velocity = movelib_vdrag(somespeed,0.01,0.7);
\r
21 float movelib_dragflt(float fspeed,float drag,float exp)
\r
25 ldrag = fspeed * drag;
\r
26 ldrag = ldrag * ldrag * exp;
\r
27 ldrag = 1 - (ldrag / fspeed);
\r
33 Do a inertia simulation based on velocity.
\r
34 Basicaly, this allows you to simulate objects loss steering with speed.
\r
35 self.velocity = movelib_inertia_fromspeed(self.velocity,newvel,1000,0.1,0.9);
\r
37 vector movelib_inertmove_byspeed(vector vel_new, float vel_max,float newmin,float oldmax)
\r
41 influense = vlen(self.velocity) * (1 / vel_max);
\r
43 influense = bound(newmin,influense,oldmax);
\r
45 return (vel_new * (1 - influense)) + (self.velocity * influense);
\r
48 vector movelib_inertmove(vector new_vel,float new_bias)
\r
50 return new_vel * new_bias + self.velocity * (1-new_bias);
\r
55 Applies absolute force to a velocity
\r
57 vector movelib_accelerate(vector vel,float force)
\r
59 return normalize(vel) * (vlen(vel) + force);
\r
61 vector movelib_decelerate(vector vel,float force)
\r
63 return normalize(vel) * (vlen(vel) - force);
\r
66 vector movelib_velocity_transfer(entity source,entity destination)
\r