Position Smoothing oddity

Hello, I was messing around with the position smoothing setting for this project and found that the saucer is able to stay on screen whenever the speed is increased. While doing this I encountered a weird issue where the saucer looked as if it was violently vibrating. Changing the process callback from idle to physics has solved the issue and I wanted to ask why this may be.

Thanks!

Hmm. Not sure exactly why that jaggedness is appearing under those conditions, and I wasn’t able to replicate it, though I did create an effect that sort of looked like screen-shake (maybe this is what you’re referring to?). That sort of thing is often caused by misalignment in different sets of calculations - physics_process() and _process() run at different effective frequencies, with process() also being framerate-dependant and therefore variable.

Because the camera is following the player, and the player is being moved by _physics_process(), it makes sense that the camera’s process callback should be set to physics. If doing that fixed this issue, that would suggest there was some variation in the frequency of your process() function that didn’t play nice with the physics calculations of your player. I don’t think I could explain your experiences much further though - to me, it doesn’t make sense that the camera settings would affect the saucer itself. Maybe someone else here knows more about this than I do.

Good that you’re playing around with stuff though! This is a great way to discover new capabilities of the engine =)

Marvelous! In that case, you may also be interested in the first heading of this: _process vs. _physics_process vs. *_input:

Enjoy the course!

I think that the difference of the frequencies that physics_process() and _process() run at was definitely causing the vibration/screen-shake. Thank you for pointing that out I had no idea that _process() didn’t run on the same frequency as physics_process().

Is there a way that I could force _process() to run at the same frequency as physics_process()?

1 Like

Maybe there’s a way to do this if you dig really deep into the engine (I doubt you can do it with GDScript), but the two functions actually exist to serve mutually-exclusive purposes. Basically, there shouldn’t be any need to do this on a project-wide scale because if you need the call behaviour of the other function, it’s best just to use that other function for your processing in that situation.

As far as I know, this is pretty much what happens when you set the process callback here to idle (_process()) vs physics, but with anything else it’s just a matter of moving your function calls or calculations from one function to the other. It can take a bit of getting used to, but the nice thing is that if you discover that something should be in _process() instead of _physics_process() for example, that’s usually a refactoring problem for later. For it to cause something game-breaking like what you saw is actually fairly uncommon based on what I’ve seen so far, so it shouldn’t really disrupt your adventures too much =)

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms