-
-
Notifications
You must be signed in to change notification settings - Fork 392
Open
Labels
Task-HardThis issue can be claimed, but it is quite difficult to resolve.This issue can be claimed, but it is quite difficult to resolve.enhancementNew feature or requestNew feature or requesthigh priorityHigh priority issueHigh priority issueparticle
Milestone
Description
背景
阻尼模块主要用于模拟空气中的摩擦力,相当于一个任意方向的空气阻力场。常见的使用场景例如,爆炸或烟花最初以极快的速度爆发,但是发射的粒子在穿过空气的过程中会由于空气阻力的原因迅速减速。常见通过2种方案实现阻力场的模拟,以 Unity LimitVelocityOverLifetime 模块为例
Unity 方案
1. Speed + Dampen
- Speed
平衡速度,只有粒子当前速度值大于speed,阻力才会生效
- Dampen
阻尼系数,当粒子速度大于speed,粒子速度根据阻力系数进行衰减。
根据Unity的表现,可以推测单位时间内速度衰减为:
// if Current_Speed > Speed
(Current_Speed - Speed) * (1 - Dampen);
// if Current_Speed <= Speed
Current_Speed;
2. Drag + MultiplyBySize + MultiplyByVelocity
- Drag
Drag 会持续降低粒子的速度,与是否超过速度限制无关。
- MultiplyBySize + MultiplyByVelocity
若启用了 Multiply by Size,较大的粒子受到的阻力更强;若启用了 Multiply by Velocity,速度越快的粒子阻力效应越显著
根据 Unity 的表现,推测其单位时间内速度衰减为:
上述公式中 n 为大于1 的整数,可以根据表现灵活调整。
公式满足当 Drag = 0, 相当于没效果,当Drag越大,衰减速度越快。
实现细节
- 对于 Speed + Dampen 方案,Speed 需要兼容单轴速度和总速度模式,对应于 Unity
Separate Axes开关
- 同样的,Speed 和 Drag 值都是 Curve
Metadata
Metadata
Assignees
Labels
Task-HardThis issue can be claimed, but it is quite difficult to resolve.This issue can be claimed, but it is quite difficult to resolve.enhancementNew feature or requestNew feature or requesthigh priorityHigh priority issueHigh priority issueparticle



