- Fixed: The coordinates need to be converted to doubles first. Also use length instead of length squared.

This commit is contained in:
MajorCooke 2016-02-10 17:48:17 -06:00
parent e04fe06226
commit fefdb266cd

View file

@ -277,8 +277,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance)
{ {
fixedvec3 diff = self->Vec3To(target); fixedvec3 diff = self->Vec3To(target);
diff.z += (target->height - self->height) / 2; diff.z += (target->height - self->height) / 2;
const double lengthsquared = TVector3<double>(diff.x, diff.y, diff.z).LengthSquared(); const double length = TVector3<double>(FIXED2DBL(diff.x), FIXED2DBL(diff.y), FIXED2DBL(diff.z)).Length();
ret->SetFloat(lengthsquared); ret->SetFloat(length);
} }
return 1; return 1;
} }