CsgPolygon3D
Extrudes a 2D polygon shape to create a 3D mesh.
Extrudes a 2D polygon shape to create a 3D mesh.
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.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
CsgPolygon3DConstructor
public CsgPolygon3D();Properties17
DepthProperty
public float Depth { get; set; }When CsgPolygon3D.Mode is CsgPolygon3D.ModeEnum.Depth, the depth of the extrusion.
MaterialProperty
public Material Material { get; set; }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 CsgPolygon3D.Polygon), the bottom-left quarter to the front end face, and the bottom-right quarter to the back end face.
ModeProperty
public CsgPolygon3D.ModeEnum Mode { get; set; }The CsgPolygon3D.Mode used to extrude the CsgPolygon3D.Polygon.
PathContinuousUProperty
public bool PathContinuousU { get; set; }When CsgPolygon3D.Mode is CsgPolygon3D.ModeEnum.Path, by default, the top half of the CsgPolygon3D.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.
PathEntityProperty
public EntityPath PathEntity { get; set; }When CsgPolygon3D.Mode is CsgPolygon3D.ModeEnum.Path, the location of the Path3D object used to extrude the CsgPolygon3D.Polygon.
PathIntervalProperty
public float PathInterval { get; set; }When CsgPolygon3D.Mode is CsgPolygon3D.ModeEnum.Path, the path interval or ratio of path points to extrusions.
PathIntervalTypeProperty
public CsgPolygon3D.PathIntervalTypeEnum PathIntervalType { get; set; }When CsgPolygon3D.Mode is CsgPolygon3D.ModeEnum.Path, this will determine if the interval should be by distance (CsgPolygon3D.PathIntervalTypeEnum.Distance) or subdivision fractions (CsgPolygon3D.PathIntervalTypeEnum.Subdivide).
PathJoinedProperty
public bool PathJoined { get; set; }When CsgPolygon3D.Mode is CsgPolygon3D.ModeEnum.Path, if true the ends of the path are joined, by adding an extrusion between the last and first points of the path.
PathLocalProperty
public bool PathLocal { get; set; }When CsgPolygon3D.Mode is CsgPolygon3D.ModeEnum.Path, if true the Transform3D of the CsgPolygon3D is used as the starting point for the extrusions, not the Transform3D of the path_node.
PathRotationProperty
public CsgPolygon3D.PathRotationEnum PathRotation { get; set; }When CsgPolygon3D.Mode is CsgPolygon3D.ModeEnum.Path, the path rotation method used to rotate the CsgPolygon3D.Polygon as it is extruded.
PathRotationAccurateProperty
public bool PathRotationAccurate { get; set; }When CsgPolygon3D.Mode is CsgPolygon3D.ModeEnum.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.
PathSimplifyAngleProperty
public float PathSimplifyAngle { get; set; }When CsgPolygon3D.Mode is CsgPolygon3D.ModeEnum.Path, extrusions that are less than this angle, will be merged together to reduce polygon count.
PathUDistanceProperty
public float PathUDistance { get; set; }When CsgPolygon3D.Mode is CsgPolygon3D.ModeEnum.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.
PolygonProperty
public Vector2[] Polygon { get; set; }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 CsgPolygon3D.Polygon, no mesh will be generated.
SmoothFacesProperty
public bool SmoothFaces { get; set; }If true, applies smooth shading to the extrusions.
SpinDegreesProperty
public float SpinDegrees { get; set; }When CsgPolygon3D.Mode is CsgPolygon3D.ModeEnum.Spin, the total number of degrees the CsgPolygon3D.Polygon is rotated when extruding.
SpinSidesProperty
public int SpinSides { get; set; }When CsgPolygon3D.Mode is CsgPolygon3D.ModeEnum.Spin, the number of extrusions made.
Methods35
GetDepthfloat
public float GetDepth();floatGetMaterialMaterial
public Material GetMaterial();MaterialGetModeCsgPolygon3D.ModeEnum
public CsgPolygon3D.ModeEnum GetMode();CsgPolygon3D.ModeEnumGetPathEntityEntityPath
public EntityPath GetPathEntity();EntityPathGetPathIntervalfloat
public float GetPathInterval();floatGetPathIntervalTypeCsgPolygon3D.PathIntervalTypeEnum
public CsgPolygon3D.PathIntervalTypeEnum GetPathIntervalType();CsgPolygon3D.PathIntervalTypeEnumGetPathRotationCsgPolygon3D.PathRotationEnum
public CsgPolygon3D.PathRotationEnum GetPathRotation();CsgPolygon3D.PathRotationEnumGetPathRotationAccuratebool
public bool GetPathRotationAccurate();boolGetPathSimplifyAnglefloat
public float GetPathSimplifyAngle();floatGetPathUDistancefloat
public float GetPathUDistance();floatGetPolygonVector2[]
public Vector2[] GetPolygon();Vector2[]GetSmoothFacesbool
public bool GetSmoothFaces();boolGetSpinDegreesfloat
public float GetSpinDegrees();floatGetSpinSidesint
public int GetSpinSides();intIsPathContinuousUbool
public bool IsPathContinuousU();boolIsPathJoinedbool
public bool IsPathJoined();boolIsPathLocalbool
public bool IsPathLocal();boolSetDepthvoid
public void SetDepth(float depth);| Name | Type | Default |
|---|---|---|
depth | float | — |
SetMaterialvoid
public void SetMaterial(Material material);| Name | Type | Default |
|---|---|---|
material | Material | — |
SetModevoid
public void SetMode(CsgPolygon3D.ModeEnum mode);| Name | Type | Default |
|---|---|---|
mode | CsgPolygon3D.ModeEnum | — |
SetPathContinuousUvoid
public void SetPathContinuousU(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetPathEntityvoid
public void SetPathEntity(EntityPath path);| Name | Type | Default |
|---|---|---|
path | EntityPath | — |
SetPathIntervalvoid
public void SetPathInterval(float interval);| Name | Type | Default |
|---|---|---|
interval | float | — |
SetPathIntervalTypevoid
public void SetPathIntervalType(CsgPolygon3D.PathIntervalTypeEnum intervalType);| Name | Type | Default |
|---|---|---|
intervalType | CsgPolygon3D.PathIntervalTypeEnum | — |
SetPathJoinedvoid
public void SetPathJoined(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetPathLocalvoid
public void SetPathLocal(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetPathRotationvoid
public void SetPathRotation(CsgPolygon3D.PathRotationEnum pathRotation);| Name | Type | Default |
|---|---|---|
pathRotation | CsgPolygon3D.PathRotationEnum | — |
SetPathRotationAccuratevoid
public void SetPathRotationAccurate(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetPathSimplifyAnglevoid
public void SetPathSimplifyAngle(float degrees);| Name | Type | Default |
|---|---|---|
degrees | float | — |
SetPathUDistancevoid
public void SetPathUDistance(float distance);| Name | Type | Default |
|---|---|---|
distance | float | — |
SetPolygon2 overloads
public void SetPolygon(Vector2[] polygon);| Name | Type | Default |
|---|---|---|
polygon | Vector2[] | — |
public void SetPolygon(ReadOnlySpan<Vector2> polygon);| Name | Type | Default |
|---|---|---|
polygon | ReadOnlySpan<Vector2> | — |
SetSmoothFacesvoid
public void SetSmoothFaces(bool smoothFaces);| Name | Type | Default |
|---|---|---|
smoothFaces | bool | — |
SetSpinDegreesvoid
public void SetSpinDegrees(float degrees);| Name | Type | Default |
|---|---|---|
degrees | float | — |
SetSpinSidesvoid
public void SetSpinSides(int spinSides);| Name | Type | Default |
|---|---|---|
spinSides | int | — |
CsgPolygon3D.ModeEnum
| Value | Description |
|---|---|
Depth = 0 | The |
Path = 2 | The |
Spin = 1 | The |
CsgPolygon3D.PathIntervalTypeEnum
| Value | Description |
|---|---|
Distance = 0 | When |
Subdivide = 1 | When |
CsgPolygon3D.PathRotationEnum
| Value | Description |
|---|---|
Path = 1 | The |
PathFollow = 2 | The |
Polygon = 0 | The |