In UE5, the new Tick Physics Async option sets the physics simulation to run on its own thread and at fixed intervals - something that’s necessary for my current project. However, this leads to a further complication for the user where that, now, they can’t know when the physics simulation happens because its not part of the game thread or its tick event.
At a high level, the Tick event in unreal works exactly like Unity’s Update method. And Unity’s FixedUpdate method works like how I’m hoping UE5’s asynchronous “Physics Tick” could work.
I’ve done a bit of digging in the source code and, firstly, I understand very little of it (I’m a noob) but, as far as I can tell, there’s no Physics Tick event exposed anywhere for the user to access. I would think that for the asynchronous physics loop to be a thing at all, there must be a Physics Tick of some kind and, hopefully, one that can be made accessible to users.
After spending two months with unreal it’s something I cringe horribly at the thought of but, if this can’t be done, I will have to transition back to Unity
So… if anyone has any knowledge or advice on how to expose the Physics Tick to the user, I’d love to hear it!
I’ve been doing some more digging in the source code and the chaos vehicle implements asynchronous physics by using its own physics scene and, by the looks of it, manages that scene within the vehicle manager. Is that what it takes?!
If anyone is still interested in this, I’ve created a plugin based off what i saw in the Chaos Vehicles plugin to expose this event in blueprints (or c++)
Just parent your pawn to the AsyncTickPawn, override the AsyncTick event and use the provided functions to apply the different forces. It can easily be modified to your needs aswell.
“If anyone is still interested in this”
Well, I’m sure a lot of people are interested in this! Thank you!
But at the moment I can’t get the Plugin to work.
I’m getting an error: The following modules are missing or built with a different engine version: AsyncTickPhysics-1.0.0 Would you like to rebuild them now?
After I click “yes” another error appears: Could not be compiled. Try rebuilding from source manually.
I’m using UE 5.0.1
EDIT: I got it to work!
I had to convert my UE5 project into C++ project (Tools > Add new C++ class) and then Right Click my .uproject file and select Generate Visual studio project files.
I’ve managed to get the plugin running in UE5, but I’m not sure if it’s working as intended.
I seem to still get differences in the physics and forces depending on framerate. (bouncing and launching under 15fps) making me think that this tick isn’t running on the async thread. All the project settings are enabled for async physics and substepping etc.
yeah i see that below like 20fps it becomes really unstable, i do think its just a chaos issue tbh since the plugin works exactly like the chaos vehicle plugin which implements the callback to the physics thread.
What happens is that the Chaos vehicle system doesn’t able to wake rigid bodies automatically, to fix it you can add a ‘wake all bodies’ node on tick or throttle, whatever you need - Here’s the kicker, this bug seems to be in the underlying system, so it was affecting your plugin too!
So on my initial goes at getting the plugin working, my vehicle I was porting from UE4 was just sat there doing nothing. Now that I’ve managed to find this workaround it works even better than it did in UE4 where I was using a substepping plugin for BP.
I’m glad you’ve been able to solve that issue and the plugin is working perfectly for you, I’ve updated the README with the fix if anyone else runs into that issue and hopefully its fixed in a later engine release
Thanks for your work! I migrate my ue4 project with machinery modelling toolkit to ue5 and replace all mmt functions. But i noticed that i cant acess physics linear/angualr velocities from async tick by standart functions. They only get values from standart event tick i think. That makes objects jittering when i try ty achieve target velocity by forces because calculations based on object velocity.
I’ve updated the plugin and added 2 functions to get the Linear Velocity and Angular Velocity on the physics thread. Hopefully this fixes the issue for you!
When I implement this and enable fixed tick in the project settings all physics seems to run slow and low gravity. Anyone else running into this issue?
EDIT: Also, when I create an async physics pawn, I can’t call any replicated events from it as these events can’t be called from a thread other than the game thread. Any work around?
What have you set the fixed time step as? I’d recommend something like 0.01.
As for the problem with calling replicated events you could create a c++ class which would allow you to run tasks on the GameThread. This is something I made which you could use:
HI ! Really awesome plugin, this is exactly what i needed to make my own character physics !
I saw that you had added a function to get the velocity or the transform during AsyncTick, but how can I set it ? I need to get the velocity of my character (with ATP Get Linear Velocity) to make a smooth interp to another velocity. But Set Physics linear Velocity or Set World Location seems to be done in the EventTick (need ATP Set Linear Velocity and ATP Set Transform).
If my AsyncTickPawn has a high velocity and I try to freeze his location with Set World Location, my Actor jitter.
Hi ! After several test of your plugin, I noticed something really strange that is problematic in my case. When I have a hierarchy of multiples RigidBodys like a sphere B in another sphere A, problems happen.
If I try to Get the Transform of the sphere A or the sphere B, the Function always gives me the sphere A Location. The function only gives the Location of the parent, never that of the children.
But If I try to Set the Location of the sphere A or the sphere B, the Function always set the (right) Location but with the center of mass as pivot, not the parent pivot.
So if I try to set the Location of my parent shpere A with its own Location (like to lock an axis for example), my spheres begin to make an infinite offset move every frames in the direction of “center of mass of hierarchy to sphere A”.
Is it possible to get and set the right location of the right target ? And if it’s not possible to handle differents childs datas, can we have the same pivot for both functions (only parent or only center of mass) ?