Xonotic
steerlib.qh File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

vector steerlib_arrive (entity this, vector point, float maximal_distance)
 Pull toward a point, The further away, the stronger the pull. More...
 
vector steerlib_attract2 (entity this, vector point, float min_influense, float max_distance, float max_influense)
 

Variables

vector steerto
 

Function Documentation

◆ steerlib_arrive()

vector steerlib_arrive ( entity  this,
vector  point,
float  maximal_distance 
)

Pull toward a point, The further away, the stronger the pull.

Definition at line 27 of file steerlib.qc.

References bound(), direction, normalize(), origin, vector(), and vlen().

Referenced by steerlib_flock(), steerlib_flock2d(), and steerlib_swarm().

28 {
29  float distance = bound(0.001, vlen(this.origin - point), maximal_distance);
30  vector direction = normalize(point - this.origin);
31  return direction * (distance / maximal_distance);
32 }
int direction
Definition: strafehud.qc:24
origin
Definition: ent_cs.qc:114
vector(float skel, float bonenum) _skel_get_boneabs_hidden
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ steerlib_attract2()

vector steerlib_attract2 ( entity  this,
vector  point,
float  min_influense,
float  max_distance,
float  max_influense 
)

Definition at line 45 of file steerlib.qc.

References bound(), direction, normalize(), origin, vector(), and vlen().

Referenced by Monster_Move().

46 {
47  float distance = bound(0.00001, vlen(this.origin - point), max_distance);
48  vector direction = normalize(point - this.origin);
49 
50  float influense = 1 - (distance / max_distance);
51  influense = min_influense + (influense * (max_influense - min_influense));
52 
53  return direction * influense;
54 }
int direction
Definition: strafehud.qc:24
origin
Definition: ent_cs.qc:114
vector(float skel, float bonenum) _skel_get_boneabs_hidden
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ steerto

vector steerto

Definition at line 3 of file steerlib.qh.

Referenced by Monster_Move().