Pages 1
Universal Fighting Engine Forum We are no longer using the forum to answer questions due to bot attacks. Please use our discord instead: https://discord.gg/hGMZhF7 |
You are not logged in. Please login or register.
Universal Fighting Engine Forum → 2D Gameplay → Reset to simulation speed 1 for particle when clone in UFE 2.6.0
I see the problem.
With UFE 2.6.0 now controlling particle simulations, it overrides the speed with its own time scale.
The solution would be to add a backup value of the original speed and add it as a multiplier on top of the time scale applied.
Try these changes. I just made them and committed to the repository. I'll issue an update soon.
Under InstantiatedGameObject.cs, you will find a definition for particles like so:
public ParticleSystem[] particles;
Change it to this
public Dictionary<ParticleSystem, float> particleStorage;
(Make sure you also change the constructors)
Now under UFE.cs look for this code (line 2085):
ParticleSystem[] particles = goInstance.GetComponentsInChildren<ParticleSystem>(true);
foreach (ParticleSystem particle in particles)
{
particle.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
particle.randomSeed = (uint)creationFrame;
}
UFE.instantiatedObjects.Add(new InstantiatedGameObject(uniqueId, goInstance, mrFusion, particles, creationFrame, creationFrame + durationFrames));
And change to this:
ParticleSystem[] particles = goInstance.GetComponentsInChildren<ParticleSystem>(true);
Dictionary<ParticleSystem, float> particleStorage = new Dictionary<ParticleSystem, float>();
foreach (ParticleSystem particle in particles)
{
particle.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
particle.randomSeed = (uint)creationFrame;
particleStorage.Add(particle, particle.main.simulationSpeed);
}
UFE.instantiatedObjects.Add(new InstantiatedGameObject(uniqueId, goInstance, mrFusion, particleStorage, creationFrame, creationFrame + durationFrames));
Now under MatchManager.cs, look for this code (line 274):
foreach (ParticleSystem particle in entry.particles)
{
var mainModule = particle.main;
mainModule.simulationSpeed = (float)UFE.timeScale;
float time = (currentFrame - entry.creationFrame) / (float)UFE.fps;
particle.Simulate(time, true, true, true);
}
And change it to this:
foreach (KeyValuePair<ParticleSystem,float> particleData in entry.particles)
{
var mainModule = particleData.Key.main;
mainModule.simulationSpeed = (float)UFE.timeScale * particleData.Value;
float time = (currentFrame - entry.creationFrame) / (float)UFE.fps;
particleData.Key.Simulate(time, true, true, true);
}
These changes should make it so UFE doesn't directly interfere with the original simulation speed value.
Thank you so much.
Universal Fighting Engine Forum → 2D Gameplay → Reset to simulation speed 1 for particle when clone in UFE 2.6.0
Powered by PunBB, supported by Informer Technologies, Inc.