I’m trying to learn unreal 4 particle system.
I want to rotate particle precisely but rorationoverlife module’s rotation value is not time dependent.
The more calling update, the faster rotation.
I diged particle module code. I found that “Rotation” doesnot integral. Just only adding each frame.
I think it must change with multiplying with deltatime for precise particle control.
Below codes in Engine\Private\Particles\ParticleModules.cpp (line 1819~)
void UParticleModuleRotationOverLifetime::Update(FParticleEmitterInstance* Owner, int32 Offset, float DeltaTime)
{
if (Scale)
{
BEGIN_UPDATE_LOOP;
{
float Rotation = RotationOverLife.GetValue(Particle.RelativeTime, Owner->Component);
// For now, we are just using the X-value
Particle.Rotation = (Particle.Rotation * (Rotation * (PI/180.f) * 360.0f));
}
END_UPDATE_LOOP;
}
else
{
BEGIN_UPDATE_LOOP;
{
float Rotation = RotationOverLife.GetValue(Particle.RelativeTime, Owner->Component);
// For now, we are just using the X-value
Particle.Rotation = (Particle.Rotation + (Rotation * (PI/180.f) * 360.0f));
}
END_UPDATE_LOOP;
}
}
Hello ,
Thank you for reporting this. Your proposition makes sense to me. As such, I’m willing to enter a feature request for this change if you wish. Otherwise, you could make a Pull Request on our Github repository if you have an idea of how to change this yourself. If you do, the Pull Request will be reviewed by a developer and either accepted or rejected. If it is accepted, you’ll become an Engine Contributor on our forums.
If you would rather me enter the feature request myself however, please let me know and I’ll do so.
I was trying to modifying rotationoverlife, but I misunderstand concept of rotation. Rotation means absolute radian not rotation speed. When rotation speed is needed, RotationRate(init, *life) modules are correct way.
So I think that rotationoverlife module will be modified below way.
-
Absolute rotation value. (Set from the above)
float Rotation = RotationOverLife.GetValue(Particle.RelativeTime, Owner->Component);
Particle.Rotation = (Rotation * (PI/180.f) * 360.0f));
-
Adding (Add by init roatation)
It needs BaseRotation in FBaseParticle struct. Rotation set by BaseRotation on each update.
float Rotation = RotationOverLife.GetValue(Particle.RelativeTime, Owner->Component);
Particle.Rotation = Particle.Rotation + (Rotation * (PI/180.f) * 360.0f));
Finally, scale option that already implemented is wrong way, because rotation value is modulated by 2*PI, I think.
Please check this way is right.
Thank you.
The math seems right but I can’t be sure that it’ll work in all situations. I would suggest making the Pull Request so that it may be reviewed by someone in depth. If changes need to be made, they will mention what needs to be changed and allow you time to do so.