I’ve actually pondered something like this myself, and the only way I can think of it is by making “custom gravity” - disabling level gravity, and using volumes to define gravity.
Keep in mind I haven’t actually TRIED any of this yet, but this is how I would do it:
-Create an asset with no physical collision (make sure overlap is enabled)
-Have that asset contain 2 main variables: world location and gravitational constant.
Then in your pawn, you use the world location and the pawn’s location to define a local “down”, and with that down you now have a direction to apply force/accelerate your pawn towards in one way or another. And if you’re feeling fancy, you can also calculate the distance between the world location of the “gravitational field” and your pawn to properly extrapolate gravity.
Of course, if you plan on having static maps, you can put all of this in your pawn.
It would scale better with C++ for large numbers of actors, but in principle Blueprints are quite capable of that.
I would approach it from the level BP.
Just define an array of world locations as barycenters. No volumes needed.
Then process all (relevant) actors in the levelscript.
ofcourse you could use volumes to opimize that a bit.
However, this would just simulate actors that dont have a geavity field of their own and are just mere “test particles” in space.
If all the actors that are subject to gravitational pull have a gravitation field as well, then you end up with the classic 3-body (or n-body) situation that can only be aproximated.
for that BP performance would be indeed a possible bottleneck.