Explorar o código

fixed Vector3.AlmostEquals()

Daniel Salvadori %!s(int64=7) %!d(string=hai) anos
pai
achega
4d1094e9cc
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      math32/vector3.go

+ 3 - 3
math32/vector3.go

@@ -671,9 +671,9 @@ func (v *Vector3) RandomTangents() (*Vector3, *Vector3) {
 // AlmostEquals returns whether the vector is almost equal to another vector within the specified tolerance.
 func (v *Vector3) AlmostEquals(other *Vector3, tolerance float32) bool {
 
-	if (v.X - other.X < tolerance) &&
-		(v.Y - other.Y < tolerance) &&
-		(v.Z - other.Z < tolerance) {
+	if (Abs(v.X - other.X) < tolerance) &&
+		(Abs(v.Y - other.Y) < tolerance) &&
+		(Abs(v.Z - other.Z) < tolerance) {
 			return true
 	}
 	return false