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
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
Remarks
mode
var mode : int = 0
Property Value
Remarks
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
Remarks
path_interval
When mode is CSGPolygon3D.MODE_PATH, the path interval or ratio of path points to extrusions.
var path_interval : float
Property Value
Remarks
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
Remarks
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
Remarks
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
Remarks
path_node
var path_node : NodePath
Property Value
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
Remarks
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
Remarks
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
Remarks
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
Remarks
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
Remarks
- void set_polygon(PackedVector2Array value)
- PackedVector2Array get_polygon
smooth_faces
If true
, applies smooth shading to the extrusions.
var smooth_faces : bool = false
Property Value
Remarks
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
Remarks
spin_sides
When mode is CSGPolygon3D.MODE_SPIN, the number of extrusions made.
var spin_sides : int