Download

Directional gravity/magnets/moving object towards player or vice versa

I’ve been messing around with the free directional gravity program made by Tefel that was free on the marketplace in October and it is incredibly buggy to say the least. I think it may be due to differences in build version but as someone with virtually no programming and very little unreal/any development experience, I have no way of knowing.

What I would like to do is make a massive sphere of water to simulate a planet, with a much smaller sphere in the center of the massive one. I would place rocks inside the massive sphere and overlay them with terrain to shape the continents which will form the basis for my game map, and I would like the player to constantly be moving toward the smaller, inner sphere to simulate downwards gravity from any side of the planet.

I feel like that much is likely easy enough to accomplish with a bit of editing, I.e, move playerid towards objectid at a rate of 9.8 m/s or so, but I do not know how to do that in-engine.
Secondly is adjusting the players rotational scale to fit with the direction they are being pulled. This seems much more difficult but happens to be the only thing which works marginally correctly in the Directional Gravity Demo Project. But again as someone without the experience I don’t know how to sift through Tefel’s work to make something that works properly in the current version of the engine nor recreate the automatic adjustment from scratch.

So the two problems that it would help immensely for me to solve are:

How to move one object towards another.
How to make the engine recognize (from the players perspective) which direction they are being pulled to.
How to rotate the character’s feet to snap to the direction they are being pulled from.

If anyone would like to help me because you saw this post, know the answer, and feel like doing so, it would be immensely cool.
Bonus points if you know how to do it in the current version of the engine.

This first link directs to a video of me trying to maneuver Tefel’s test project, the second is Tefel demonstrating it working correctly.

https://www.twitch.tv/videos/505015891
https://youtube.com/watch?v=bcTqFA23P9Y
**Edit, Or how to move the character/face the character’s feet towards a specific coordinate, that might be even more helpful.

I know that this is not specifically physics and such but could be a solution for you to simulate the planet or anything spherical - https://www.unrealengine.com/marketp…curve-material

This way you wouldn’t need to use some brutal 3D vector math (you will still use vector math, but simpler).

How to move one object towards another, check this node (they are pretty straight forward):

  • MoveComponentTo node

So with MoveComponentTo is quite flexible because it moves a component/actor from its current location to the TargetRelativeLocation (which in our case would be the object you want to move to) in a smooth movement.

How to make the engine recognize (from the players perspective) which direction they are being pulled to
How to rotate the character’s feet to snap to the direction they are being pulled from:

  • LookAt node - I am not completely sure if this what you want, but in your explanation you wrote that you want the object to be oriented toward the target object. So this node is for you.

Thank you so much for your awesome and very quick reply!

I do not know if this would work for me since I am trying to make a map for online multiplayer, but it is definitely an option I am looking at now.
The part that bugs me is that this seems to curve the world from the players perspective and that seems like it would go wonky in multiplayer.

Also I’m going for a supermassive planet not a little planet, but I don’t know how related that really is.

Shouldn’t it be as simple as using the MoveComponentTo node to have the player constantly moving towards the center of the sphere and having them move away from the center of the sphere when they jump? (and having their feet/camera face the right direction but that is a smaller part of the whole.)

Again thanks so much for your near immediate reply, super cool.

Yes, it should work with MoveComponentTo node, you can move a component in 3D. :slight_smile: