Up to date

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

CSGCylinder3D

继承: CSGPrimitive3D < CSGShape3D < GeometryInstance3D < VisualInstance3D < Node3D < Node < Object

CSG 圆柱形状。

描述

此节点允许你创建与 CSG 系统一起使用的圆柱体(或圆锥体)。

注意:CSG 节点旨在用于关卡原型设计。与使用 PrimitiveMesh 创建 MeshInstance3D 相比,创建 CSG 节点具有显着的 CPU 成本。在另一个 CSG 节点中,移动一个 CSG 节点,也会大量消耗 CPU,因此在游戏过程中,应该避免这种情况。

教程

属性

bool

cone

false

float

height

2.0

Material

material

float

radius

0.5

int

sides

8

bool

smooth_faces

true


属性说明

bool cone = false

  • void set_cone ( bool value )

  • bool is_cone ( )

如果为 true,则创建圆锥,仅在一侧应用 radius


float height = 2.0

  • void set_height ( float value )

  • float get_height ( )

圆柱体的高度。


Material material

用于渲染圆柱体的材质。


float radius = 0.5

  • void set_radius ( float value )

  • float get_radius ( )

圆柱体的半径。


int sides = 8

  • void set_sides ( int value )

  • int get_sides ( )

圆柱体的边数越多,圆柱体的细节越多。


bool smooth_faces = true

  • void set_smooth_faces ( bool value )

  • bool get_smooth_faces ( )

如果为 true,则将圆柱体的法线设置为具有平滑效果,使圆柱体看起来是圆形的。如果为 false,则圆柱体将具有平坦的阴影表现。