Up to date

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

CylinderMesh

继承: PrimitiveMesh < Mesh < Resource < RefCounted < Object

表示圆柱形 PrimitiveMesh 的类。

描述

表示圆柱形 PrimitiveMesh 的类。通过将 top_radiusbottom_radius 属性设置为 0.0,这个类可以用来创建圆锥体。

属性

float

bottom_radius

0.5

bool

cap_bottom

true

bool

cap_top

true

float

height

2.0

int

radial_segments

64

int

rings

4

float

top_radius

0.5


属性说明

float bottom_radius = 0.5

  • void set_bottom_radius ( float value )

  • float get_bottom_radius ( )

圆柱体的底部半径。如果设置为 0.0,则不会生成底面,呈圆锥状。另见 cap_bottom


bool cap_bottom = true

  • void set_cap_bottom ( bool value )

  • bool is_cap_bottom ( )

如果为 true,则在圆柱体底部生成一个盖子。这可以设置为 false 以在相机从未看到盖子时加速生成和渲染。另见 bottom_radius

注意:如果 bottom_radius0.0,即使 cap_bottomtrue,盖子生成也会始终被跳过。


bool cap_top = true

  • void set_cap_top ( bool value )

  • bool is_cap_top ( )

如果为 true,则在圆柱体顶部生成一个盖子。这可以设置为 false 以在相机从未看到盖子时加速生成和渲染。另见 top_radius

注意:如果 top_radius0.0,即使 cap_toptrue,盖子生成也会始终被跳过。


float height = 2.0

  • void set_height ( float value )

  • float get_height ( )

圆柱体的全高。


int radial_segments = 64

  • void set_radial_segments ( int value )

  • int get_radial_segments ( )

圆柱体上的径向段数。更高的值会生成更细致的圆柱体或圆锥体,但以性能为代价。


int rings = 4

  • void set_rings ( int value )

  • int get_rings ( )

沿圆柱体的高度的边缘环的数量。除非使用着色器或程序网格工具来更改顶点数据,否则更改 rings 不会影响显示,rings 应保持其默认值。较高的值会产生更多的细分,这可用于使用着色器或程序式网格工具创建更平滑的显示效果,但以性能为代价。


float top_radius = 0.5

  • void set_top_radius ( float value )

  • float get_top_radius ( )

圆柱体的顶部半径。如果设置为 0.0,则不会生成顶面,呈圆锥状。另见 cap_top