Up to date

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

# 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¶

 Plane[] build_box_planes ( Vector3 extents ) Plane[] build_capsule_planes ( float radius, float height, int sides, int lats, Vector3.Axis axis=2 ) Plane[] build_cylinder_planes ( float radius, float height, int sides, Vector3.Axis axis=2 ) PackedVector3Array clip_polygon ( PackedVector3Array points, Plane plane ) PackedVector3Array Vector3 get_closest_point_to_segment ( Vector3 point, Vector3 s1, Vector3 s2 ) Vector3 PackedVector3Array Vector3 Variant ray_intersects_triangle ( Vector3 from, Vector3 dir, Vector3 a, Vector3 b, Vector3 c ) PackedVector3Array segment_intersects_convex ( Vector3 from, Vector3 to, Plane[] planes ) PackedVector3Array segment_intersects_cylinder ( Vector3 from, Vector3 to, float height, float radius ) PackedVector3Array segment_intersects_sphere ( Vector3 from, Vector3 to, Vector3 sphere_position, float sphere_radius ) Variant

## Method Descriptions¶

Plane[] build_box_planes ( Vector3 extents )

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).

Plane[] build_capsule_planes ( float radius, float height, int sides, int lats, Vector3.Axis 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).

Plane[] build_cylinder_planes (