Table of Contents

Class CSGPolygon3D

Extrudes a 2D polygon shape to create a 3D mesh.

Inheritance
CSGPolygon3D

Remarks

An array of 2D points is extruded to quickly and easily create a variety of 3D meshes. See also CSGMesh3D for using 3D meshes as CSG nodes.

Note: CSG nodes are intended to be used for level prototyping. Creating CSG nodes has a significant CPU cost compared to creating a MeshInstance3D with a PrimitiveMesh. Moving a CSG node within another CSG node also has a significant CPU cost, so it should be avoided during gameplay.

See Also

Properties

depth

When mode is CSGPolygon3D.MODE_DEPTH, the depth of the extrusion.

var depth : float = 1.0

Property Value

float

Remarks

material

Material to use for the resulting mesh. The UV maps the top half of the material to the extruded shape (U along the length of the extrusions and V around the outline of the polygon), the bottom-left quarter to the front end face, and the bottom-right quarter to the back end face.

var material : Material

Property Value

Material

Remarks

mode

The mode used to extrude the polygon.

var mode : int = 0

Property Value

int

Remarks

  • void set_mode(int value)
  • int get_mode

path_continuous_u

When mode is CSGPolygon3D.MODE_PATH, by default, the top half of the material is stretched along the entire length of the extruded shape. If false the top half of the material is repeated every step of the extrusion.

var path_continuous_u : bool

Property Value

bool

Remarks

  • void set_path_continuous_u(bool value)
  • bool is_path_continuous_u

path_interval

When mode is CSGPolygon3D.MODE_PATH, the path interval or ratio of path points to extrusions.

var path_interval : float

Property Value

float

Remarks

  • void set_path_interval(float value)
  • float get_path_interval

path_interval_type

When mode is CSGPolygon3D.MODE_PATH, this will determine if the interval should be by distance (CSGPolygon3D.PATH_INTERVAL_DISTANCE) or subdivision fractions (CSGPolygon3D.PATH_INTERVAL_SUBDIVIDE).

var path_interval_type : int

Property Value

int

Remarks

  • void set_path_interval_type(int value)
  • int get_path_interval_type

path_joined

When mode is CSGPolygon3D.MODE_PATH, if true the ends of the path are joined, by adding an extrusion between the last and first points of the path.

var path_joined : bool

Property Value

bool

Remarks

  • void set_path_joined(bool value)
  • bool is_path_joined

path_local

When mode is CSGPolygon3D.MODE_PATH, if true the Transform3D of the CSGPolygon3D is used as the starting point for the extrusions, not the Transform3D of the path_node.

var path_local : bool

Property Value

bool

Remarks

  • void set_path_local(bool value)
  • bool is_path_local

path_node

When mode is CSGPolygon3D.MODE_PATH, the location of the Path3D object used to extrude the polygon.

var path_node : NodePath

Property Value

NodePath

Remarks

path_rotation

When mode is CSGPolygon3D.MODE_PATH, the path rotation method used to rotate the polygon as it is extruded.

var path_rotation : int

Property Value

int

Remarks

  • void set_path_rotation(int value)
  • int get_path_rotation

path_rotation_accurate

When mode is CSGPolygon3D.MODE_PATH, if true the polygon will be rotated according to the proper tangent of the path at the sampled points. If false an approximation is used, which decreases in accuracy as the number of subdivisions decreases.

var path_rotation_accurate : bool

Property Value

bool

Remarks

  • void set_path_rotation_accurate(bool value)
  • bool get_path_rotation_accurate

path_simplify_angle

When mode is CSGPolygon3D.MODE_PATH, extrusions that are less than this angle, will be merged together to reduce polygon count.

var path_simplify_angle : float

Property Value

float

Remarks

  • void set_path_simplify_angle(float value)
  • float get_path_simplify_angle

path_u_distance

When mode is CSGPolygon3D.MODE_PATH, this is the distance along the path, in meters, the texture coordinates will tile. When set to 0, texture coordinates will match geometry exactly with no tiling.

var path_u_distance : float

Property Value

float

Remarks

  • void set_path_u_distance(float value)
  • float get_path_u_distance

polygon

The point array that defines the 2D polygon that is extruded. This can be a convex or concave polygon with 3 or more points. The polygon must not have any intersecting edges. Otherwise, triangulation will fail and no mesh will be generated.

Note: If only 1 or 2 points are defined in polygon, no mesh will be generated.

var polygon : PackedVector2Array = PackedVector2Array(0, 0, 0, 1, 1, 1, 1, 0)

Property Value

PackedVector2Array

Remarks

smooth_faces

If true, applies smooth shading to the extrusions.

var smooth_faces : bool = false

Property Value

bool

Remarks

  • void set_smooth_faces(bool value)
  • bool get_smooth_faces

spin_degrees

When mode is CSGPolygon3D.MODE_SPIN, the total number of degrees the polygon is rotated when extruding.

var spin_degrees : float

Property Value

float

Remarks

  • void set_spin_degrees(float value)
  • float get_spin_degrees

spin_sides

When mode is CSGPolygon3D.MODE_SPIN, the number of extrusions made.

var spin_sides : int

Property Value

int

Remarks

  • void set_spin_sides(int value)
  • int get_spin_sides