[英]Unity particle system does not rotate correctly
I'm having a small issue where the particle system is not behaving the way I command it to.我遇到了一个小问题,即粒子系统没有按照我命令的方式运行。
I made a blob, that jumps / dashes.我做了一个斑点,跳跃/破折号。 When-ever he does, I spawn in particles that will give him a dash effect.
每当他这样做时,我都会生成粒子,这会给他带来冲刺效果。 ( When the blob dashes right, the particles go left, etc.. )
(当 blob 向右划线时,粒子向左移动,依此类推。)
The problem is that my dash effect works for Left and Right ( Rotation of the particle system -90 & 90 ).问题是,我的冲刺效应对于左,右(粒子系统的旋转-90 90)。 When I jump UP and DOWN I rotate the particle system to 0 & 180 , how ever the up and down particle's don't rotate.
当我向上和向下跳跃时,我将粒子系统旋转到0 和 180 ,但是向上和向下的粒子不旋转。 ( See GIF ).
(见GIF)。
I tried this in 2 ways, code and a pre-set prefab for every angle, the code looks as following我以两种方式尝试了这个,代码和每个角度的预设预制件,代码如下
//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);
}
The prefab looks as following :预制件如下所示:
GIF : https://i.gyazo.com/3ecf2991f10d0ab763423aa254d72364.mp4动图: https : //i.gyazo.com/3ecf2991f10d0ab763423aa254d72364.mp4
You're rotating around the Y axis, so a 90 rotation will point left/right, but a 180 degree rotation will point to/away from the camera.您围绕 Y 轴旋转,因此 90 度旋转将指向左/右,但 180 度旋转将指向/远离相机。
To rotate the particle system to point up and down, try rotating 90 degrees around the X axis.要旋转粒子系统以向上和向下指向,请尝试围绕 X 轴旋转 90 度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.