Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to work around freefall humanoid state or to make consistent pseudo-gravity?

Asked by 4 years ago
Edited 4 years ago

For my custom mobs, whenever they spawn, there's always around a 50/50 chance that they start sliding around like this https://gyazo.com/508bf15a7d4af4330e1ad286304e3c36. Whenever this bug happens, the sliding mobs are always in the freefall humanoid state.

To fix this, I disabled the freefall humanoid state, but then that means that they can't actually fall and experience gravity. If they were to fall off a ledge or experience some sort of vertical force, they would stay floating in the air https://gyazo.com/3f662749b07d0d4c5af4b32c2140db71.

Then to fix THIS, I added in my own gravity bodyforce. Unfortunately, this does not work either because that means that the pseudo-gravity's parent would always have to remain in perfect orientation. If they were disoriented for even a split second, then they would suddenly have some unwanted permanent velocity https://gyazo.com/5473fd0a9a978af85907798a3c8bc58c. I can't even update the velocity through a while loop because gravity obviously isn't the only acceleration in my game.

I realize that I can have some sort of while loop that updates each gravity bodyforce to constantly remain -9.8 m/s^2 downwards relative to the world, but I'm not sure how intensive that would be, considering that all of this is done on the server, and the rate of calculating and updating these forces would have to be pretty high to avoid any sort of wacky floating for a few seconds.

So, I was wondering if anyone knew a workaround to any of these issues, or if my proposed solution of constantly readjusting each body force every second is safe enough. I would probably have around 50+ of these mobs at any given moment.

Answer this question