Prevent divize by zero crash

This commit is contained in:
MegaMech
2025-03-29 20:13:11 -06:00
parent 1b65c2f74a
commit 6fb2c2df2b
+6 -3
View File
@@ -53,9 +53,12 @@ struct FVector {
FVector Normalize() const {
float len = std::sqrt(x * x + y * y + z * z);
return FVector(
x / len, y / len, z / len
);
if (len > 0.0001f) {
return FVector(
x / len, y / len, z / len
);
}
return FVector(0, 0, 0);
}
FVector() : x(0), y(0), z(0) {}