Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Geometry3D

Inherits: Object

Provides methods for some common 3D geometric operations.

Description

Provides a set of helper functions to create geometric shapes, compute intersections between shapes, and process various other geometric operations in 3D.

Methods

Array[Plane]

build_box_planes(extents: Vector3)

Array[Plane]

build_capsule_planes(radius: float, height: float, sides: int, lats: int, axis: Vector3.Axis = 2)

Array[Plane]

build_cylinder_planes(radius: float, height: float, sides: int, axis: Vector3.Axis = 2)

PackedVector3Array

clip_polygon(points: PackedVector3Array, plane: Plane)

PackedVector3Array

compute_convex_mesh_points(planes: Array[Plane])

Vector3

get_closest_point_to_segment(point: Vector3, s1: Vector3, s2: Vector3)

Vector3

get_closest_point_to_segment_uncapped(point: Vector3, s1: Vector3, s2: Vector3)

PackedVector3Array

get_closest_points_between_segments(p1: Vector3, p2: Vector3, q1: Vector3, q2: Vector3)

Vector3

get_triangle_barycentric_coords(point: Vector3, a: Vector3, b: Vector3, c: Vector3)

Variant

ray_intersects_triangle(from: Vector3, dir: Vector3, a: Vector3, b: Vector3, c: Vector3)

PackedVector3Array

segment_intersects_convex(from: Vector3, to: Vector3, planes: Array[Plane])

PackedVector3Array

segment_intersects_cylinder(from: Vector3, to: Vector3, height: float, radius: float)

PackedVector3Array

segment_intersects_sphere(from: Vector3, to: Vector3, sphere_position: Vector3, sphere_radius: float)

Variant

segment_intersects_triangle(from: Vector3, to: Vector3, a: Vector3, b: Vector3, c: Vector3)

PackedInt32Array

tetrahedralize_delaunay(points: PackedVector3Array)


Method Descriptions

Array[Plane] build_box_planes(extents: Vector3)

Returns an array with 6 Planes that describe the sides of a box centered at the origin. The box size is defined by extents, which represents one (positive) corner of the box (i.e. half its actual size).


Array[Plane] build_capsule_planes(radius: float, height: float, sides: int, lats: int, axis: Vector3.Axis = 2)

Returns an array of Planes closely bounding a faceted capsule centered at the origin with radius radius and height height. The parameter sides defines how many planes will be generated for the side part of the capsule, whereas lats gives the number of latitudinal steps at the bottom and top of the capsule. The parameter axis describes the axis along which the capsule is oriented (0 for X, 1 for Y, 2 for Z).


Array[