From fefdb266cd048b02b676943f575d9c712c9f1593 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Wed, 10 Feb 2016 17:48:17 -0600 Subject: [PATCH] - Fixed: The coordinates need to be converted to doubles first. Also use length instead of length squared. --- src/thingdef/thingdef_codeptr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; }