diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 9a8e02468..0949dd6a6 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -277,8 +277,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance) { fixedvec3 diff = self->Vec3To(target); diff.z += (target->height - self->height) / 2; - const double lengthsquared = TVector3(diff.x, diff.y, diff.z).LengthSquared(); - ret->SetFloat(lengthsquared); + const double length = TVector3(FIXED2DBL(diff.x), FIXED2DBL(diff.y), FIXED2DBL(diff.z)).Length(); + ret->SetFloat(length); } return 1; }