TrailsModule 的脚本接口。
此模块向粒子添加轨迹。例如,可以使轨迹在粒子移动时紧随粒子,或者使轨迹在系统中连接每一个粒子。
另请参阅:ParticleSystem、ParticleSystem.trails。
using UnityEngine; using System.Collections;
[RequireComponent(typeof(ParticleSystem))] public class ExampleClass : MonoBehaviour { void Start() { ParticleSystem ps = GetComponent<ParticleSystem>(); var trails = ps.trails; trails.enabled = true; trails.ratio = 0.5f; } }
attachRibbonsToTransform | 为每个轨迹带添加一个额外位置,将其连接到变换组件的位置。 |
colorOverLifetime | 在附加粒子生命周期内控制轨迹颜色的渐变。 |
colorOverTrail | 沿轨迹长度控制轨迹颜色的渐变。 |
dieWithParticles | 指定轨迹在其拥有的粒子湮灭时是否立即消失。如果是 false,每个轨迹会持续存在到其所有点都自然过期(基于其生命周期)。 |
enabled | 指定启用还是禁用 TrailModule。 |
generateLightingData | 配置轨迹以生成法线和切线。借助此数据,场景光照可以通过法线贴图和 Unity 标准着色器或您自己的定制着色器来影响轨迹。 |
inheritParticleColor | 切换轨迹是否继承粒子颜色作为其初始颜色。 |
lifetime | 在整个粒子生命周期内描述轨迹生命周期的曲线。 |
lifetimeMultiplier | ParticleSystem.TrailModule.lifetime 的乘数。 |
minVertexDistance | 设置每个轨迹在系统向其添加新顶点之前可以行进的最小距离。 |
mode | 选择系统如何生成粒子轨迹。 |
ratio | 选择将接收轨迹的粒子比例。 |
ribbonCount | 选择要通过粒子系统创建的线条数。 |
shadowBias | 应用阴影偏差以防止自我阴影瑕疵。指定的值是每一段的轨迹宽度比例。 |
sizeAffectsLifetime | 设置粒子大小是否充当轨迹生命周期的乘数。 |
sizeAffectsWidth | 设置粒子大小是否充当轨迹宽度的乘数。 |
splitSubEmitterRibbons | 指定在使用此系统作为子发射器时,轨迹带是否独立地连接来自每个父粒子的粒子。 |
textureMode | 选择轨迹纹理的 U 坐标是进行平铺还是拉伸。 |
textureScale | A multiplier for the UV coordinates of the trail texture. |
widthOverTrail | 描述每个轨迹点的宽度的曲线。 |
widthOverTrailMultiplier | ParticleSystem.TrailModule.widthOverTrail 的乘数。 |
worldSpace | 将新轨迹点放置在世界空间中(与粒子系统模拟空间无关)。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.