#Particle systems lagging behind fast moving objects

1 messages · Page 1 of 1 (latest)

wild jackal
#

I am trying to use particle systems for the fire FX of vessel thrusters in my game, and I am interpolating their positions in a script to achieve a nice, consistent trail without having to use ps.emission.rateOverDistance which can be finnicky at the extremes (too fast / too slow). I will attach that script below. I will also share some debugging tools I use to help get a frame of reference here.

My thoughts / questions:

  • I don't want to predict where the thrusters will be next frame, because this may cause problems with high speed collisions and other similar cases, but if there is an easy & reliable way to do this, I may look into it.
  • Does physics running in fixedupdate() vs rendering happening in update() cause problems with physics-enabled objects rendering behind where the truly are?? I don't think this is the case but it would explain this observed behaviour.
  • Why do my debug.drawlines appear to confirm that the particle systems do indeed physically lag behind the vessel in world space?

Video of debug & issue in action: https://youtu.be/uGetCXgPTOM (debug lines indicate the difference between the last position of the particle system and the current position)

(Apologies if this should be in #⚛️┃physics or #✨┃vfx-and-particles, but I felt this should be posted here since an in-script solution seems most likely to me)

#

ignore the discord code block formatting lol I tried to just copy paste first

wild jackal
#

btw, Activate(float ratio) is called by controller / brain scripts

dense stump
#

Yes, fixed update can lag behind the regular update. If your vessel is moved in update, then that's the core of the issue.

#

You either need to love both in fixed update or in normal update.

wild jackal
#

They are both in FixedUpdate(), which is why I am confused

#

I wonder if this is more specifically an issue with particle systems themselves since it seems like the actual gameobject is lagging behind in space based on the debug information

#

Not sure how that is even possible when it is patented to the moving object but it’s just a guess

dense stump
wild jackal
#

Yup. Fully physics driven

dense stump
#

You should probably move it in update. Is there any reason you need to move it in fixed update?

wild jackal
#

just concerns with framerate affecting the particles' behavior since they can collide with objects & deal fire damage

#

but this seems like an easier problem to fix, so I may look into moving it in update

dense stump
#

If you need it to behave as a physical object, you should add a rigidbody and move it via that in update. Then if you enable interpolation on, it should be in sync with the vessel itself.

wild jackal
#

After working through this for the entirety of my time today, I have decided to ignore this issue unless I am struck by a stroke of genius

dense stump
#

I mean, it should be pretty easy to address. I've already outlined the options you have.

wild jackal
#

I think I did a poor job of outlining all the factors, which is on me