:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/3.5/modules/csg/doc_classes/CSGPolygon.xml. .. _class_CSGPolygon: CSGPolygon ========== **Inherits:** :ref:`CSGPrimitive` **<** :ref:`CSGShape` **<** :ref:`GeometryInstance` **<** :ref:`VisualInstance` **<** :ref:`CullInstance` **<** :ref:`Spatial` **<** :ref:`Node` **<** :ref:`Object` Extrudes a 2D polygon shape to create a 3D mesh. Description ----------- An array of 2D points is extruded to quickly and easily create a variety of 3D meshes. See also :ref:`CSGMesh` 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 :ref:`MeshInstance` with a :ref:`PrimitiveMesh`. Moving a CSG node within another CSG node also has a significant CPU cost, so it should be avoided during gameplay. Tutorials --------- - :doc:`Prototyping levels with CSG <../tutorials/3d/csg_tools>` Properties ---------- +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`float` | :ref:`depth` | ``1.0`` | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`Material` | :ref:`material` | | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`Mode` | :ref:`mode` | ``0`` | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`bool` | :ref:`path_continuous_u` | | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`float` | :ref:`path_interval` | | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`PathIntervalType` | :ref:`path_interval_type` | | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`bool` | :ref:`path_joined` | | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`bool` | :ref:`path_local` | | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`NodePath` | :ref:`path_node` | | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`PathRotation` | :ref:`path_rotation` | | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`float` | :ref:`path_simplify_angle` | | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`float` | :ref:`path_u_distance` | | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`PoolVector2Array` | :ref:`polygon` | ``PoolVector2Array( 0, 0, 0, 1, 1, 1, 1, 0 )`` | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`bool` | :ref:`smooth_faces` | ``false`` | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`float` | :ref:`spin_degrees` | | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ | :ref:`int` | :ref:`spin_sides` | | +-----------------------------------------------------------+---------------------------------------------------------------------------+------------------------------------------------+ Enumerations ------------ .. _enum_CSGPolygon_Mode: .. _class_CSGPolygon_constant_MODE_DEPTH: .. _class_CSGPolygon_constant_MODE_SPIN: .. _class_CSGPolygon_constant_MODE_PATH: enum **Mode**: - **MODE_DEPTH** = **0** --- The :ref:`polygon` shape is extruded along the negative Z axis. - **MODE_SPIN** = **1** --- The :ref:`polygon` shape is extruded by rotating it around the Y axis. - **MODE_PATH** = **2** --- The :ref:`polygon` shape is extruded along the :ref:`Path` specified in :ref:`path_node`. ---- .. _enum_CSGPolygon_PathRotation: .. _class_CSGPolygon_constant_PATH_ROTATION_POLYGON: .. _class_CSGPolygon_constant_PATH_ROTATION_PATH: .. _class_CSGPolygon_constant_PATH_ROTATION_PATH_FOLLOW: enum **PathRotation**: - **PATH_ROTATION_POLYGON** = **0** --- The :ref:`polygon` shape is not rotated. \ **Note:** Requires the path's Z coordinates to continually decrease to ensure viable shapes. - **PATH_ROTATION_PATH** = **1** --- The :ref:`polygon` shape is rotated along the path, but it is not rotated around the path axis. \ **Note:** Requires the path's Z coordinates to continually decrease to ensure viable shapes. - **PATH_ROTATION_PATH_FOLLOW** = **2** --- The :ref:`polygon` shape follows the path and its rotations around the path axis. ---- .. _enum_CSGPolygon_PathIntervalType: .. _class_CSGPolygon_constant_PATH_INTERVAL_DISTANCE: .. _class_CSGPolygon_constant_PATH_INTERVAL_SUBDIVIDE: enum **PathIntervalType**: - **PATH_INTERVAL_DISTANCE** = **0** --- When :ref:`mode` is set to :ref:`MODE_PATH`, :ref:`path_interval` will determine the distance, in meters, each interval of the path will extrude. - **PATH_INTERVAL_SUBDIVIDE** = **1** --- When :ref:`mode` is set to :ref:`MODE_PATH`, :ref:`path_interval` will subdivide the polygons along the path. Property Descriptions --------------------- .. _class_CSGPolygon_property_depth: - :ref:`float` **depth** +-----------+------------------+ | *Default* | ``1.0`` | +-----------+------------------+ | *Setter* | set_depth(value) | +-----------+------------------+ | *Getter* | get_depth() | +-----------+------------------+ When :ref:`mode` is :ref:`MODE_DEPTH`, the depth of the extrusion. ---- .. _class_CSGPolygon_property_material: - :ref:`Material` **material** +----------+---------------------+ | *Setter* | set_material(value) | +----------+---------------------+ | *Getter* | get_material() | +----------+---------------------+ Material to use for the resulting mesh. The UV maps the top half of the material to the extruded shape (U along the the length of the extrusions and V around the outline of the :ref:`polygon`), the bottom-left quarter to the front end face, and the bottom-right quarter to the back end face. ---- .. _class_CSGPolygon_property_mode: - :ref:`Mode` **mode** +-----------+-----------------+ | *Default* | ``0`` | +-----------+-----------------+ | *Setter* | set_mode(value) | +-----------+-----------------+ | *Getter* | get_mode() | +-----------+-----------------+ The :ref:`mode` used to extrude the :ref:`polygon`. ---- .. _class_CSGPolygon_property_path_continuous_u: - :ref:`bool` **path_continuous_u** +----------+------------------------------+ | *Setter* | set_path_continuous_u(value) | +----------+------------------------------+ | *Getter* | is_path_continuous_u() | +----------+------------------------------+ When :ref:`mode` is :ref:`MODE_PATH`, by default, the top half of the :ref:`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. ---- .. _class_CSGPolygon_property_path_interval: - :ref:`float` **path_interval** +----------+--------------------------+ | *Setter* | set_path_interval(value) | +----------+--------------------------+ | *Getter* | get_path_interval() | +----------+--------------------------+ When :ref:`mode` is :ref:`MODE_PATH`, the path interval or ratio of path points to extrusions. ---- .. _class_CSGPolygon_property_path_interval_type: - :ref:`PathIntervalType` **path_interval_type** +----------+-------------------------------+ | *Setter* | set_path_interval_type(value) | +----------+-------------------------------+ | *Getter* | get_path_interval_type() | +----------+-------------------------------+ When :ref:`mode` is :ref:`MODE_PATH`, this will determine if the interval should be by distance (:ref:`PATH_INTERVAL_DISTANCE`) or subdivision fractions (:ref:`PATH_INTERVAL_SUBDIVIDE`). ---- .. _class_CSGPolygon_property_path_joined: - :ref:`bool` **path_joined** +----------+------------------------+ | *Setter* | set_path_joined(value) | +----------+------------------------+ | *Getter* | is_path_joined() | +----------+------------------------+ When :ref:`mode` is :ref:`MODE_PATH`, if ``true`` the ends of the path are joined, by adding an extrusion between the last and first points of the path. ---- .. _class_CSGPolygon_property_path_local: - :ref:`bool` **path_local** +----------+-----------------------+ | *Setter* | set_path_local(value) | +----------+-----------------------+ | *Getter* | is_path_local() | +----------+-----------------------+ When :ref:`mode` is :ref:`MODE_PATH`, if ``true`` the :ref:`Transform` of the ``CSGPolygon`` is used as the starting point for the extrusions, not the :ref:`Transform` of the :ref:`path_node`. ---- .. _class_CSGPolygon_property_path_node: - :ref:`NodePath` **path_node** +----------+----------------------+ | *Setter* | set_path_node(value) | +----------+----------------------+ | *Getter* | get_path_node() | +----------+----------------------+ When :ref:`mode` is :ref:`MODE_PATH`, the location of the :ref:`Path` object used to extrude the :ref:`polygon`. ---- .. _class_CSGPolygon_property_path_rotation: - :ref:`PathRotation` **path_rotation** +----------+--------------------------+ | *Setter* | set_path_rotation(value) | +----------+--------------------------+ | *Getter* | get_path_rotation() | +----------+--------------------------+ When :ref:`mode` is :ref:`MODE_PATH`, the :ref:`PathRotation` method used to rotate the :ref:`polygon` as it is extruded. ---- .. _class_CSGPolygon_property_path_simplify_angle: - :ref:`float` **path_simplify_angle** +----------+--------------------------------+ | *Setter* | set_path_simplify_angle(value) | +----------+--------------------------------+ | *Getter* | get_path_simplify_angle() | +----------+--------------------------------+ When :ref:`mode` is :ref:`MODE_PATH`, extrusions that are less than this angle, will be merged together to reduce polygon count. ---- .. _class_CSGPolygon_property_path_u_distance: - :ref:`float` **path_u_distance** +----------+----------------------------+ | *Setter* | set_path_u_distance(value) | +----------+----------------------------+ | *Getter* | get_path_u_distance() | +----------+----------------------------+ When :ref:`mode` is :ref:`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. ---- .. _class_CSGPolygon_property_polygon: - :ref:`PoolVector2Array` **polygon** +-----------+------------------------------------------------+ | *Default* | ``PoolVector2Array( 0, 0, 0, 1, 1, 1, 1, 0 )`` | +-----------+------------------------------------------------+ | *Setter* | set_polygon(value) | +-----------+------------------------------------------------+ | *Getter* | get_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 :ref:`polygon`, no mesh will be generated. ---- .. _class_CSGPolygon_property_smooth_faces: - :ref:`bool` **smooth_faces** +-----------+-------------------------+ | *Default* | ``false`` | +-----------+-------------------------+ | *Setter* | set_smooth_faces(value) | +-----------+-------------------------+ | *Getter* | get_smooth_faces() | +-----------+-------------------------+ If ``true``, applies smooth shading to the extrusions. ---- .. _class_CSGPolygon_property_spin_degrees: - :ref:`float` **spin_degrees** +----------+-------------------------+ | *Setter* | set_spin_degrees(value) | +----------+-------------------------+ | *Getter* | get_spin_degrees() | +----------+-------------------------+ When :ref:`mode` is :ref:`MODE_SPIN`, the total number of degrees the :ref:`polygon` is rotated when extruding. ---- .. _class_CSGPolygon_property_spin_sides: - :ref:`int` **spin_sides** +----------+-----------------------+ | *Setter* | set_spin_sides(value) | +----------+-----------------------+ | *Getter* | get_spin_sides() | +----------+-----------------------+ When :ref:`mode` is :ref:`MODE_SPIN`, the number of extrusions made. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`