Up to date

This page is up to date for Godot `4.2`. If you still find outdated information, please open an issue.

# Plane¶

A plane in Hessian normal form.

## Description¶

Represents a normalized plane equation. normal is the normal of the plane (a, b, c normalized), and d is the distance from the origin to the plane (in the direction of "normal"). "Over" or "Above" the plane is considered the side of the plane towards where the normal is pointing.

## Properties¶

 float d `0.0` Vector3 normal `Vector3(0, 0, 0)` float x `0.0` float y `0.0` float z `0.0`

## Constructors¶

 Plane Plane ( ) Plane Plane ( Plane from ) Plane Plane ( float a, float b, float c, float d ) Plane Plane ( Vector3 normal ) Plane Plane ( Vector3 normal, float d ) Plane Plane ( Vector3 normal, Vector3 point ) Plane Plane ( Vector3 point1, Vector3 point2, Vector3 point3 )

## Methods¶

 float distance_to ( Vector3 point ) const Vector3 get_center ( ) const bool has_point ( Vector3 point, float tolerance=1e-05 ) const Variant intersect_3 ( Plane b, Plane c ) const Variant intersects_ray ( Vector3 from, Vector3 dir ) const Variant intersects_segment ( Vector3 from, Vector3 to ) const bool is_equal_approx ( Plane to_plane ) const bool is_finite ( ) const bool is_point_over ( Vector3 point ) const Plane normalized ( ) const Vector3 project ( Vector3 point ) const

## Operators¶

 bool operator != ( Plane right ) Plane operator * ( Transform3D right ) bool operator == ( Plane right ) Plane Plane

## Constants¶

PLANE_YZ = `Plane(1, 0, 0, 0)`

A plane that extends in the Y and Z axes (normal vector points +X).

PLANE_XZ = `Plane(0, 1, 0, 0)`

A plane that extends in the X and Z axes (normal vector points +Y).

PLANE_XY = `Plane(0, 0, 1, 0)`

A plane that extends in the X and Y axes (normal vector points +Z).

## Property Descriptions¶

float d = `0.0`

The distance from the origin to the plane, expressed in terms of normal (according to its direction and magnitude). Actual absolute distance from the origin to the plane can be calculated as `abs(d) / normal.length()` (if normal has zero length then this Plane does not represent a valid plane).

In the scalar equation of the plane `ax + by + cz = d`, this is `d`, while the `(a, b, c)` coordinates are represented by the normal property.

Vector3 normal = `Vector3(0, 0, 0)`

The normal of the plane, typically a unit vector. Shouldn't be a zero vector as Plane with such normal does not represent a valid plane.

In the scalar equation of the plane `ax + by + cz = d`, this is the vector `(a, b, c)`, where `d` is the d property.

float x = `0.0`

The X component of the plane's normal vector.

float y = `0.0`

The Y component of the plane's normal vector.

float z = `0.0`

The Z component of the plane's normal vector.

## Constructor Descriptions¶

Plane Plane ( )

Constructs a default-initialized Plane with all components set to `0`.

Plane Plane ( Plane from )

Constructs a Plane as a copy of the given Plane.

Plane Plane ( float a, float b, float c, float d )

Creates a plane from the four parameters. The three components of the resulting plane's normal are `a`, `b` and `c`, and the plane has a distance of `d` from the origin.

Plane Plane ( Vector3 normal )

Creates a plane from the normal vector. The plane will intersect the origin.

The `normal` of the plane must be a unit vector.

Plane Plane ( Vector3 normal, float d )

Creates a plane from the normal vector and the plane's distance from the origin.

The `normal` of the plane must be a unit vector.

Plane Plane ( Vector3 normal, Vector3 point )

Creates a plane from the normal vector and a point on the plane.

The `normal` of the plane must be a unit vector.

Plane Plane ( Vector3 point1, Vector3 point2, Vector3 point3 )

Creates a plane from the three points, given in clockwise order.

## Method Descriptions¶

float distance_to ( Vector3 point ) const

Returns the shortest distance from the plane to the position `point`. If the point is above the plane, the distance will be positive. If below, the distance will be negative.

Vector3 get_center ( ) const

Returns the center of the plane.

bool has_point ( Vector3 point, float tolerance=1e-05 ) const

Returns `true` if `point` is inside the plane. Comparison uses a custom minimum `tolerance` threshold.

Variant intersect_3 ( Plane b, Plane c ) const

Returns the intersection point of the three planes `b`, `c` and this plane. If no intersection is found,