【发布时间】:2018-09-07 19:21:45
【问题描述】:
我遇到了一个小问题,即粒子系统的行为与我的命令不同。
我做了一个斑点,它跳跃/破折号。每当他这样做时,我都会生成粒子,这会给他带来冲刺效果。 (当 blob 向右冲时,粒子向左移动,等等。)
问题是我的破折号效果适用于 Left 和 Right (粒子系统的旋转 -90 和 90 )。 当我跳 UP 和 DOWN 时,我将粒子系统旋转到 0 和 180,但是上下粒子不会旋转。 (见 GIF)。
我尝试了两种方式,代码和每个角度的预设预制件,代码如下所示
//The method takes a Vector3 Rotation e.g : ( 0,90,0 )
//This only works for left and right, not for up and down ( 0 & 180 ).
//
private void ParticleSpawner(Vector3 rot)
{
ParticleSystem ps = dashEffect.GetComponent<ParticleSystem>();
var sh = ps.shape;
sh.enabled = true;
sh.shapeType = ParticleSystemShapeType.Cone;
sh.rotation = rot;
sh.angle = 33;
sh.radius = .1f;
Instantiate(dashEffect, transform.position, Quaternion.identity);
}
预制件如下所示:
GIF:https://i.gyazo.com/3ecf2991f10d0ab763423aa254d72364.mp4
【问题讨论】: