Idk if "radial force" was a component a year ago... but it seems to work great for gravity applied by an object, you should look into it Matt. A quick explanation of how to use it: create planet, add "radial force" component and make it apply a negative impulse, and apply that impulse over event tick, (may also need a negative force [I had hoped that it would work without supplying impulses, but that doesn't seem to be the case]) then all you need is a big enough radius, which is easy enough to make dynamically proportionate to the planet's radius! Great tutorial btw, they really help!
I think the problem why you can't control the rotation of a character blueprint class is because the character blueprint class has a Capsule Component as top level element and in viewport under the 'transform' tab the only option is to change the scale. When you create a pawn from scratch your top level element will be a Default Scene Root and if you put a Capsule Compnent within this scene root it then can be rotated as you wish. As soon as you delete the Default Scene Root from your Pawn you no longer can rotate that Capsule Component.
Hi Matt! I've made my own character controller similar to this (first in unity, then in unreal, as I transitioned to unreal). It's been nagging me in the back of my head to use c++ (daunting, scary) instead of blueprints for it, because of how everyone is like DON'T DO TICK IN BLUEPRINT IF YOU CAN HELP IT. Have you found if this even matters on a larger scale? If 200 custom capsules are running around a planetoid, does it have a larger performance difference vs 200 characters running around on the ground with a regular CharacterMovement component?
I am not a 100% sure why everyone is avoiding event tick, but I believe it to be optimization, since it fires even though it might not be relevant in some situations A good alternatives are timelines, you can make them loop, which is essentially like event tick, but you have the option to turn it off when its not needed
Hello Matt, all right? I have a problem, whenever I keep the walk button pressed, it just starts to go up and off the planet, I have no idea how to fix this...
when you set up the controls, moving forward and moving to the right are essentially the same except of the get vector node right? somehow I cant get it work, only forward works This is such a simple thing, I have no idea what could be wrong, its literally copy n paste
AWESOME TUTORIAL!!! can you explain how to limit the jumping to to 1 jump until you land ... I'm also having a bit of jitter after landing while moving ... hoping you could explain how to work around these issues.. thnax in advance!
when i go past the equator the directions flip because of the negative(?). How do I get my camera to stay oriented z down as well? just repeat for camera?
OMG.... Fantastic tutorial Matt! do you think this might work with a Character BP and its walk animation in the future, or it´s impossible with current Unreal update? well i´m going to try... this tutorial it´s just spectacular.
I gave it a shot and ran into some trouble. I used a custom character BP with camera hooked up much the same way as in this tutorial. But he camera kept turning suddenly when transiting the globe vertically (in world space). I don't know why this would happen or how to fix it. Second getting the walking animation working is going to take a bit of doing (but should be possible). The character won't be in the "walking" state on the planet because the maximum walkable angle is in world space (and to change would require an engine level change). This means the character will be in either the falling or flying state. Getting the animation to work would probably require hooking up motion in the flying state to the animation. Haven't tried that myself.
If the only problem you had was the camera, but walk animation did work right for back, right, left etc, then maybe you could have a second camera without spring arm, and this camera could switch every time you touch a planet... i haven´t try this, but i think the problem by using a pawn is the lack of a movement component, that´s why a character its way better option, try a camera without spring arm and maybe ther is another way to simulate the same effect that spring arm does.
Hi, loved the tutorial, but I do not know why i have been reaching escape velocity. Tried using a clamp but it did not do anything. You have some idea on why is it happening?
Gonna try this, thank you. I am interested if this is workable for flying vehicle that could level itself to made up "planet". Thank you for sharing this tutorial. When I try some tests, I will posts how it went for me ;-)
Same. I think each new set physics velocity you add overrides the last one. At least that's what happening with me. If I remove the gravity part I can move forward and backward but not sideways, if I remove forward movement I can move sideways then, but if I put forward back sideways stop again.
I want to make a planet sized map using height maps but I can't find a tutorial. I can add gravity at later I'm just trying to figure out how to make a full-scale planet. I only need one.
Maybe something like: Break the relative rotation and remake it and when doing so: Set the value for the axis in question to the min of what it was or the max value you want for the limit. Make sure you use relative rotation.
It's really hard to debug without seeing the issue and looking at the code but my guess would be that some rotation that should be applied around one axis is being applied around another.
@@matttaylor4803 I've fixed it. Just turned up Linear and angular Damping in my pawn's mesh. Must say - This tutorial is very helpful! I'm making a survival game where you are on a very small moon (very small, around house sized) and you have to get off of it
A particularly difficult task considering clamping speed/rotation is typically done from the world frame of reference rather than the frame of reference of the planet. Made even worse if the planet is rotating. I've never come up with a perfect solution, but a good start is to: 1) grab the surface location below the pawn on the surface of the closest planet 2) set a scene component object at the hit location and attach it to the planet 3) save the world location of the scene component as a vector 4) on the next frame grab that scene components new vector and compare to the last to get the instantaneous tangential velocity of the surface of the ground below you. 5) use that tangential velocity as a frame of reference to calculate velocity max etc in any given direction 6) move the scene component to directly below you again, rinse and repeat 1-6
I added this script to a pawn and it worked fine. But it is not working for the AI.. can you help me with how to add this same gravity to AI and make it chase the player.
You probably will have to write your own nav mesh code and implement a version of an AI algorithm (A* etc.) using 3D space. I'm not sure if UE4's Nav stuff is going to work for the surface of a square. Conversely you could do something out of the box like map the points of the surface of a sphere to a flat plane and then have a marker for where your character is on the planet on the plane and have the AI navigate on the plane and then map their position back to the BP on the planet.... No matter what it will be a lot of trial and error work (unless UE has something I'm unfamiliar with).
It should work but I would not use the landscape itself as the gravitational object. But you can probably wrap a planet in a deformed landscape and have it work.
I have a first person camera attached to my pawn, and when I am on the surface, it jitters quite badly. Is there a step I missed, or a way to stop the jitter?
Can you make a tutorial please where you can show how to create planet with UE4 Landscape tool? Static mesh are not useful - we need Planet made out with UE4 built in Landscape tools - that makes possible to use splines, auto materials, foliage painter and even sculpt easy manually and etc good stuff - but static mesh cannot do all these things! Please make tutorial for planet creation with UE4 Landscapes!!!