Unreal Engine 4 - Planetary Character Part 1: Staying Upright!

Sdílet
Vložit
  • čas přidán 27. 08. 2024
  • Use Blueprints to create a pawn that can be controlled while moving around a planet while maintaining correct camera orientation!
    YAY!

Komentáře • 91

  • @Pistolsatsean
    @Pistolsatsean Před 4 lety +8

    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!

    • @trampflips101
      @trampflips101 Před 4 lety +1

      Yeah I honestly thought this is what would be used, glad it exists now!

    • @thegreendude2086
      @thegreendude2086 Před 2 lety +1

      thank you for sharing this, its really hard to find a tutorial that is somewhat recent and this definetly helps

    • @Pistolsatsean
      @Pistolsatsean Před 2 lety

      @@thegreendude2086 Your welcome! Good luck with your projects!

  • @themadduck8784
    @themadduck8784 Před 10 měsíci

    Five years later this saved me, thank the heavens!

  • @cyrusjameskhan
    @cyrusjameskhan Před 5 lety +16

    Great tutorial, works fine on a perfect sphere. though I'm trying to set this up with a more uneven planet terrain and having no luck.. :/

  • @somethingwentwrong196
    @somethingwentwrong196 Před 5 lety +3

    Reminds me of Brackeys ludum dare entry. Nice tutorial! Thank you!

  • @u3dsbvrge272
    @u3dsbvrge272 Před rokem

    100 likes. I found reaaly good and simply implemented gravity orientation. Thanks a lot for sharing yours experience

  • @jensfutterer9333
    @jensfutterer9333 Před 2 lety +1

    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.

  • @LittleBlue42
    @LittleBlue42 Před 6 lety +1

    You could make your own "landed" state by using a line trace or by adding a collision component to check it you are on a surface.

  • @PolyStylized
    @PolyStylized Před 5 lety

    Thank You so much, I have looked for documentation for this for years!!

  • @skrever645
    @skrever645 Před 2 lety

    Просто лучший!!!
    Спасибо большое за урок, раскрыл глаза мои!!!!

  • @mrlnmnr
    @mrlnmnr Před rokem +2

    still work on ue 5.0.3. i just change some values, like linear dumping

  • @TheModExperiment
    @TheModExperiment Před 6 měsíci

    This works great on ue4, but it would be cool to see it on ue5 :3

  • @blakegt.7326
    @blakegt.7326 Před 6 lety +2

    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.

    • @matttaylor4803
      @matttaylor4803  Před 6 lety +1

      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.

    • @blakegt.7326
      @blakegt.7326 Před 6 lety +1

      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.

  • @coolnamesTV
    @coolnamesTV Před 4 lety

    excellent video, thank you

  • @OlahLingling
    @OlahLingling Před 4 lety +3

    Hey nice tutorial thx for that!
    But after taking a few steps on my Planet im always starting to take off, can someone tell me whats wrong pls?

  • @QuiteDan
    @QuiteDan Před 2 lety

    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?

    • @thegreendude2086
      @thegreendude2086 Před 2 lety

      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

  • @icosart1520
    @icosart1520 Před 3 lety

    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!

  • @Thermal694
    @Thermal694 Před 3 lety

    Amazing!

  • @Latvian3Dman
    @Latvian3Dman Před 6 lety

    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 ;-)

  • @hxlxna_9962
    @hxlxna_9962 Před 8 měsíci

    Hey! This works great, but I want to use a skeletal mesh. And if I use one, it doesn't work anymore. any tips for that?

  • @unrealengineruseng9583

    Thank you man !!! You can help me !!!

  • @taoMi-jw4kx
    @taoMi-jw4kx Před 4 měsíci

    How do I apply this series in UE5.2? I've encountered some unsolvable problems.

  • @oow_vini
    @oow_vini Před rokem

    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...

  • @wolflyset
    @wolflyset Před 5 lety +1

    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?

  • @thegreendude2086
    @thegreendude2086 Před 2 lety

    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

  • @DKJens44
    @DKJens44 Před 4 lety +6

    I cant moving my mesh :(

    • @MZR_ytb
      @MZR_ytb Před 4 lety

      Same

    • @rodrigoxavier3222
      @rodrigoxavier3222 Před 3 lety

      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.

    • @logmatrix7911
      @logmatrix7911 Před 3 lety

      @@rodrigoxavier3222 Set the "Set Physics Linear Velocity" to "Add to Current" to Yes.

  • @ericlassard9
    @ericlassard9 Před 3 lety

    You can use ninja character asset

  • @DarksealStudios
    @DarksealStudios Před 3 lety

    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?

  • @phycogsmithomniscience309

    dont know why it doesn't work for you, but for 3rd person it works in new game mode, maybe its cause im using unreal 4.20

  • @PolyStylized
    @PolyStylized Před 4 lety

    Hello, I was wondering if anyone has found a way to combine this with the VRExpansion plugin?

  • @unrealengineruseng9583

    THANK YOU MAN !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @digitaldruglord6888
    @digitaldruglord6888 Před 4 lety

    how can we make a pawn walk up and around a cube without falling?

  • @nukima11
    @nukima11 Před 4 lety

    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.

  • @GameDevs4Fun
    @GameDevs4Fun Před 6 lety

    Everything works but my camera does weird things. Is there any way you can upload the project to github, please?

  • @Hasan-gh9gv
    @Hasan-gh9gv Před 5 lety

    How to show how to swipe lane on this planat like Endless runner ?

  • @Melobotica
    @Melobotica Před 2 lety

    Please do this in Unreal Engine 5, this doesnt work anymore

  • @boxjump4033
    @boxjump4033 Před 3 lety

    i can't move / i just can move my player camera
    is it because the update? / 2 years
    Help me plz

  • @UserNotFound00101
    @UserNotFound00101 Před 6 lety

    Hey Matt, love your tutorials. Im trying to apply this to a game Im working on, but my character spins around like crazy! Any idea why?

    • @Yipper64
      @Yipper64 Před 5 lety +1

      if it still matters to you, 18:40 may have been your issue.

  • @icosart1520
    @icosart1520 Před 2 lety

    awesome tutorial... I tried to replicate this on UE5 with no success.. any chance you're going to make an updated version?

    • @matttaylor4803
      @matttaylor4803  Před 2 lety +2

      Possibly. I've actually started messing around with a more generalizable version of the thing. We'll see how much time I have.

  • @amswan
    @amswan Před 2 lety

    ive done it three times now, step by painful fucking step - no dice

  • @amswan
    @amswan Před 2 lety

    doesnt seem to work

  • @bigsk8743
    @bigsk8743 Před 2 lety

    How would i go about clamping the speed and rotation of the pawn?

    • @matttaylor4803
      @matttaylor4803  Před 2 lety

      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

    • @bigsk8743
      @bigsk8743 Před 2 lety +1

      @@matttaylor4803 Thank you so much :)

  • @Rossilaz58
    @Rossilaz58 Před 5 lety

    My physics seems to be broken - whenever i walk i spin around in a circle at an increasing pace with no way to stop it.

    • @voicehead
      @voicehead Před 5 lety

      sounds like my life in a nutshell

    • @matttaylor4803
      @matttaylor4803  Před 5 lety

      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.

    • @voicehead
      @voicehead Před 5 lety

      ..sounds like my life in a nutshell

    • @Rossilaz58
      @Rossilaz58 Před 5 lety

      @@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

  • @lucasmarins7535
    @lucasmarins7535 Před 3 lety

    is there any way to limit the camera's rotation on the y axis ?

    • @matttaylor4803
      @matttaylor4803  Před 3 lety

      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.

  • @2ndclss
    @2ndclss Před 4 lety

    How did you open up world settings at 1:12??? I only have details.

    • @2ndclss
      @2ndclss Před 3 lety

      lol foudn the old comment. i figured it out tho

  • @chacoolman3392
    @chacoolman3392 Před 5 lety

    my Jumping doesn't work? );

  • @lordofthelair6716
    @lordofthelair6716 Před 2 lety

    Can we add a landscape to the planet?

    • @matttaylor4803
      @matttaylor4803  Před 2 lety +1

      Not easily. I'd recommend modeling a landscape for a sphere outside UE and bringing it in. Foliage is also difficult.

    • @lordofthelair6716
      @lordofthelair6716 Před 2 lety

      @@matttaylor4803 youtu.be/zDLks
      i just wanna know, how did he do it?

  • @usualspace3247
    @usualspace3247 Před 4 lety

    I got it working, however the rotation wont update when moving across the planet, what can I do?

    • @Zumito
      @Zumito Před 4 lety

      agrega la rotación del planeta al actor

    • @PolyStylized
      @PolyStylized Před 4 lety

      Heyyyyyyy UsualSpace! It's such a small world :)

    • @usualspace3247
      @usualspace3247 Před 4 lety +1

      @@PolyStylized hey you!

  • @somethingwentwrong196
    @somethingwentwrong196 Před 5 lety

    landed on the planet but bounces me infinitely after jumping.

  • @n1lknarf
    @n1lknarf Před 5 lety

    does this works for a regular landscape?

    • @matttaylor4803
      @matttaylor4803  Před 5 lety

      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.

  • @arunbalajism1386
    @arunbalajism1386 Před 4 lety

    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.

    • @matttaylor4803
      @matttaylor4803  Před 4 lety +1

      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).

    • @arunbalajism1386
      @arunbalajism1386 Před 4 lety

      @@matttaylor4803 Thank you for the reply.... I'll try what you told.

  • @II-er7gj
    @II-er7gj Před 4 lety

    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!!!

  • @LittleBlue42
    @LittleBlue42 Před 6 lety

    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?

    • @LittleBlue42
      @LittleBlue42 Před 6 lety

      @ProVenatus I managed to mitigate it by doing some clever line tracing tricks to create my own "on the ground" mode.

    • @Bredmirror
      @Bredmirror Před 3 lety

      @@LittleBlue42 With the line trace did you change the velocity or the rotation?

  • @user-fv4rx1ku6k
    @user-fv4rx1ku6k Před 5 lety

    Dont work