MCPcopy Create free account
hub / github.com/assaultcube/AC / PredictPos

Function PredictPos

source/src/bot/bot_util.cpp:332–343  ·  view source on GitHub ↗

Prediction: - pos: Current position - vel: Current velocity - Time: In seconds, predict how far it is in Time seconds

Source from the content-addressed store, hash-verified

330// - vel: Current velocity
331// - Time: In seconds, predict how far it is in Time seconds
332vec PredictPos(vec pos, vec vel, float Time)
333{
334 float flVelLength = vel.magnitude();
335
336 if (flVelLength <= 1.0)
337 return pos; // don't bother with low velocities...
338
339 vec v_end = vel;
340 v_end.mul(Time);
341 v_end.add(pos);
342 return v_end;
343}
344
345// returns true if the given file is valid
346bool IsValidFile(const char *szFileName)

Callers 1

GetEnemyPosMethod · 0.85

Calls 3

magnitudeMethod · 0.80
mulMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected