Making a character walk on a planet | Planetary Gravity (Blueprints - Unreal Engine 4.8)

Hello,

I am developing a game where the character walks on a planet. I am an absolute beginner to Unreal Engine and Blueprints. I have been following this tutorial playlist to create a third person shooter style game but with the character walking on a planet (somewhat like Super Mario Galaxy - video reference).

My biggest challenge so far has been to generate a planetary gravity where the gravity originates from the center of the planet. However, this tutorial helped me in creating a function that calculates the surface location and normal and applies it to the actor.

This following update to my Character Blueprint does make the gravity work:

But I am not sure what event to attach as the trigger. If I attach InputAxis MoveForward or MoveRight event, the character just keeps moving on it’s own. I have tried to attach other events, but it does not work.

Does anybody have an idea what should trigger this function? Do let me know if you need any further information from my side. ( :

Thanks in advance.

Best,
Ashin

1 Like

Yeah, there are dozens of posts asking about that. Simply put, I don’t think it’s possible in UE4 without some serious C++ skills. In UE4 gravity always points down. The best solution is to rotate the planet as opposed to moving the player while spawning your buildings etc. just over the horizon out of sight. Otherwise when you get to the bottom your player will be bouncing on his head, running perfectly, just bouncing on his head. I haven’t kept up on it so there may be a solution somewhere, but as far as I know it’s been this way since way back in the UDK days.

Gravity always points down? Strange. I did disable gravity for both the capsule component and the mesh inside the CharacterBP. My player is not bouncing on it’s head when it gets to the bottom, but it is just moving on it’s own. And I cannot figure out why.

I took screen-capture to make it a little more easy to understand. In the beginning I play the game without setting the character’s location and rotation, and later I activate it by attaching it to movement input nodes.

[video]https://drive.google.com/file/d/0Bwiw9EfUxaE3ODluRGE5enFsUWc/view[/video]

This makes me feel that since I am updating the location and rotation of the character manually, perhaps there is a glitch in the trigger. Maybe I should not attach it Movement Forward or Movement Right nodes. But if my situation is the same as you described, maybe I should just go with rotating the planet.

This has been done. Here is a video link: Just use the twin stick pawn, then add a skeletal mesh component to it to get a character in there…here is link

Watch this
Unreal Engine 4: Planetary gravity with COM (Center Of Mass)(Inverted gravity) - YouTube and this Unreal Engine 4 Directional Gravity and Gravitation Simulation Tutorial - YouTube

I definitely think it’s possible with blueprints. I’m personally trying to get this working with a player character instead of a regular character so I don’t think the twin stick shooter will work but the basic principle should be the same. I’ll post back if I ever figure it out.

I wonder if there is an option for having multiple objects producing their own gravity and simply jump between them. I mean I am on a sphere that holds me from falling, but when I jump too close to another sphere, the gravity changes and pulls me to itself.

I think this is what you’re looking for bud. This was and still is free on the UE4 Marketplace. works with UE4.24

Directional & Planetary Gravity

2 Likes