Skip to content

Commit 2d3cafe

Browse files
committed
godot-core: src: builtin: changed Plane function to be more accurate in respect to their Godot equivalent
1 parent 060cf8c commit 2d3cafe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

godot-core/src/builtin/plane.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,14 @@ impl Plane {
217217
/// Returns a normalized copy of the plane.
218218
#[inline]
219219
pub fn normalized(self) -> Self {
220-
Plane::new(self.normal.normalized(), self.d)
220+
let length: real = self.normal.length();
221+
if length == 0.0 {
222+
return Plane {
223+
normal: Vector3::ZERO,
224+
d: 0.0,
225+
};
226+
}
227+
Plane::new(self.normal.normalized(), self.d / length)
221228
}
222229

223230
/// Returns the orthogonal projection of `point` to the plane.

0 commit comments

Comments
 (0)