mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-07-09 23:02:11 -04:00
Prevent divize by zero crash
This commit is contained in:
@@ -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) {}
|
||||
|
||||
Reference in New Issue
Block a user