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

Function shorten

source/src/weapon.cpp:769–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

767}
768
769void shorten(const vec &from, vec &target, float distsquared)
770{
771 target.sub(from);
772 float m = target.squaredlen();
773 if(m < 0.07f) target.add(vec(0.1f, 0.1f, 0.1f)); // if "from == target" just fake a target to avoid zero-length fx vectors
774 else target.mul(max(0.07f, sqrtf(distsquared / m)));
775 target.add(from);
776}
777
778void raydamage(vec &from, vec &to, playerent *d)
779{

Callers 2

loopiFunction · 0.85
raydamageFunction · 0.85

Calls 5

vecClass · 0.85
maxFunction · 0.85
squaredlenMethod · 0.80
mulMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected