Rotate multiple actors around central origin

The original functionality I was trying to create was the ability to change the direction of gravity on any axis but default physics / character movement only supports gravity on the Z-axis.

I decided that a good way to fake the direction of gravity would be to rotate the entire level around the center point. I’m experiencing some difficulty implementing this however…

I have tried creating a rotatableActor blueprint and having all objects inherit from it. When “gravity direction” is changed, I get all objects of that class and rotate them

Issues:

  • Neither local or world rotation seems to have the desired effects; objects rotate around their individual origins, not the center of the level
  • Not sure how to determine the center of the level, or even how I would rotate around that point
  • Implementation feels sloppy, there is probably a cleaner way

It would be nice if you could simply rotate the entire level, but I don’t think that is possible.

It’s actually easy enough to fake gravity. Just disable gravity on the actor, and then on tick use Add Force to apply the desired gravity.

The gravity should be the desired vector direction multiplied by 980.

Baseline gravity, for example, would be 0/0/-980.

Using this method, I created something a while back that allowed a scifi motorcycle to drive along walls and ceilings, by getting the normal direction of the surface beneath and multiplying that by -980.

If you expect the actor to fall far enough, you may also want to account for terminal velocity. Just run a check on the actor’s velocity see if it exceeds a certain length before deciding if force should be applied.

I just upvoted Gtrimwolfs suggestion, it is simplest and performance light. If I was aiming to rotate the level though, I’d put a scene root at 0,0,0 and make everything a child of it… then I’d rotate the scene parent. I’m not sure it would work, but it’s an interesting challenge :slight_smile:

It does, I’ve already done this

Awesome tip Unzkilled. i’d been thinking about trying this, nice to know it works. Definitely try it out now.