• News

• Industries

• Learning & Support

• Community

• Marketplace

# Run around a planet

hi, im a beginner of unreal engine and im looking for a way to make my character rotate around a planet like the sphere in this video ,https://www.youtube.com/watch?v=tU9ZfqW2Ph4 .

How can i do this? I can do it with blueprint or i have to use c++?

Should be fairly simple to do in BP. You just need to calculate the point on the sphere, which is simple maths. Google

It’s easier to make the character run in place while the planet rotates under him unless you plan on doing a ton of C++ coding. UE4 usually only recognizes gravity as pointing downwards and it takes some fancy footwork to get a character running upside down. So what you want to do is figure out how far the planet rotates and/or turns based upon the character’s speed and direction - then generate random level assets (which are attached to the sphere) just before they come into view over the horizon.

It actually would be very simple to have a basic simulated planetary gravity for just a player, it will be hard coded per object, but it can work. If I get a good result from testing today, I’ll post a tutorial here.

Couldn’t you just place a null at the center and use a LookAt? And then constrain the distance to the radius of your sphere.

I was thinking of attaching the player to a SpringArm and having the origin be the center of the sphere.

The problem, as I’ve seen it as far back as UE3, is that the engine will always calculate gravity as being ‘down’. So your character will run around the sphere but he/she will always point in the same direction (ie bouncing on their head upside down when they reach the bottom of the sphere). Like I said, there were and still are literally dozens of people working on it. There are some things posted here if you search, I think I saw something where someone got a spider to crawl on walls. There’s also the issue of physics objects. Whatever you do to your character has to be replicated in every physics object as well. Otherwise you blow something up on one side and it acts normally, but you blow something up on the other side and it floats away. I could be wrong though someone may have cracked the code. Like I said though, it’s easier to keep your character stationary, running in place and rotate the world beneath him that way everything works the way it’s supposed to. That’s how most ‘endless runner’ games work. The props spawn over the horizon out of sight and ride the sphere until they are behind the player then they disappear.

I do something very similar to make a magnetic effect on a sphere physics player. It’s pretty simply a line trace to the center of the object. Getting the normal and applying force in that direction (your new gravity) while at the same time cancelling out the force of gravity (down). It’s only a few nodes but if you would like I could provide an image of my blueprint.

I would like. Very much so.

As would I TheFoyer.

Ok I’ll try to remember this tonight when I am at my development machine!

Maby it should me easier if you get the down direction of the player and face it every frame to the point of a sphere by a force