Up to date

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

TubeTrailMesh

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

代表直管状的 PrimitiveMesh,宽度可变。

描述

TubeTrailMesh 代表直管状的网格,宽度可变。管身由若干圆柱形分区构成,每个分区的长度 section_length 和环数 section_rings 都是一致的。会沿着管身的总长度对 curve 采样,这样该曲线就确定了管子半径沿长度的变化方式。

这个基本网格通常用于粒子拖尾。

教程

属性

bool

cap_bottom

true

bool

cap_top

true

Curve

curve

int

radial_steps

8

float

radius

0.5

float

section_length

0.2

int

section_rings

3

int

sections

5


属性说明

bool cap_bottom = true

  • void set_cap_bottom ( bool value )

  • bool is_cap_bottom ( )

如果为 true ,则在管子的底部生成盖子。如果相机永远不可能见到盖子,那么设置为 false 可以加快生成和渲染的速度。


bool cap_top = true

  • void set_cap_top ( bool value )

  • bool is_cap_top ( )

如果为 true ,则在管子的顶部生成盖子。如果相机永远不可能见到盖子,那么设置为 false 可以加快生成和渲染的速度。


Curve curve

  • void set_curve ( Curve value )

  • Curve get_curve ( )

确定管身半径沿长度的变化方式。将基础 radius 与给定距离下该曲线的取值相乘,就得到了某个分区中某个环的半径。小于 0 的值会让面进行正反翻转。


int radial_steps = 8

  • void set_radial_steps ( int value )

  • int get_radial_steps ( )

管身的面数。例如,取值 5 表示管身为五边形。值越高,管身细节越高,代价是牺牲性能。


float radius = 0.5

  • void set_radius ( float value )

  • float get_radius ( )

管身的基础半径。将该半径与给定距离下 curve 的取值相乘,就得到了某个分区中某个环的半径。


float section_length = 0.2

  • void set_section_length ( float value )

  • float get_section_length ( )

管身分区的长度。


int section_rings = 3

  • void set_section_rings ( int value )

  • int get_section_rings ( )

分区中环的数量。每个环都会对 curve 进行采样,从而决定其半径。值越高,管身细节越高,代价是牺牲性能。


int sections = 5

  • void set_sections ( int value )

  • int get_sections ( )

管身分区总数。