Unreal Engine 5 Tutorial - Custom Gravity UE5.4 Preview

Sdílet
Vložit
  • čas přidán 11. 09. 2024

Komentáře • 52

  • @elcid2651
    @elcid2651 Před 4 měsíci +6

    I implemented something similar to this using the Pawn class in an earlier version of UE. To get the camera and movement working like in standard "flat" gravity, I needed to derive the movement vector by making a Right vector from the camera's right and the Actor's Up vector, and a Forward vector from the camera's forward and the Actor's Up, and then apply them as 2D input into the movement component. I think the only drawback was that I had to limit the camera so it never goes quite to 90 degrees above or beyond the player, but aside from that, it was a pretty solid foundation for the rest of the movement logic.

    • @kkayaoglu
      @kkayaoglu Před 4 měsíci

      Hello, I designed a similar system too on my project. Can you share blueprint screenshots if possible?

    • @elcid2651
      @elcid2651 Před 4 měsíci +3

      @@kkayaoglu I don't know how to share screenshots on CZcams unfortunately, and it's a bit of a mess anyway (unfinished project). I can more or less describe it to you though: For the right movement vector I'm taking the forward vector from a rotator 'Make Rot from ZX' in which the Z value is 'Get Up Vector from Actor' and the X Value is the forward vector from a 'Make Rotation from X Vector' from the Camera's right vector. NOTE: I'm not actually using the camera's vectors, because I found these unreliable, so instead I attached Arrow components to the camera, and used their X vectors to get the camera's Right and Forward vector. The forward movement vector is pretty much the same thing, except I used the camera's forward vector: So I took the Forward vector from a rotator 'Make Rot ZX' in which the Z value is 'Get Up Vector from Actor' and the X Value is the forward vector from 'Make Rotation from X Vector' from the Camera's forward vector (the forward vector from the Arrow component attached to the camera). As mentioned before, it doesn't hold up if the camera goes above 90 degrees, so I had a function to limit camera movement to just below that, and also I ran into issues whenever I enabled camera lag, though that may have been down to how I implemented my combat system. Anyway, hope that helps. If you know a way to upload screenshots, let me know!

  • @Eric_Heberling
    @Eric_Heberling Před 4 měsíci +3

    Great video. I'd be interetsed in inverse gravity. Like in a space wheel, cylinder or ring world.

  • @activemotionpictures
    @activemotionpictures Před 11 dny +1

    Mindblowing tutorial. Also, thank you for explaining every decision in mind! This is so helpful. Quick question: Would it be possible to assign this to a niagara particle mesh sys and have the character gravity walking on a bunch of spheres randomly separated?

  • @zanesnep
    @zanesnep Před 2 dny

    Please make a follow up! I'm still learning how to do blueprints, and I really want to know how to make the camera rotate relative to the player's rotation/position. Oh, and if you wanted to make other things like objects, vehicles, and other characters react to the gravity field as well, that would be sick! Thank you so much, man!

  • @pailpencott7303
    @pailpencott7303 Před 3 měsíci +4

    Camera --- get world rotation --- break rotator(z) --- (z)make rotator --- get forward vector / get right vector

    • @CruelCrusader90
      @CruelCrusader90 Před 2 měsíci

      arnt you just splitting the pins and recombining them? >.> break rotator doesn't remove the previous values, it just splits the pins. >.>
      edit: you can right click the "Get World Rotation" output pin and click split struct pins.

  • @theorycraft7138
    @theorycraft7138 Před 2 měsíci

    This is perfect, ive been playing gravity rush 2 recently and have been feeling inspired a bit

  • @enderlive5339
    @enderlive5339 Před 4 měsíci +1

    Thank you man, was hard to figure out for me, much appreciated !

  • @MgamingStudios
    @MgamingStudios Před 4 měsíci +1

    This is awesome I planned on make a space based game soon 🙌

  • @wii58739
    @wii58739 Před 4 měsíci +1

    Looks really dope!

  • @TorQueMoD
    @TorQueMoD Před 4 měsíci

    Cool new feature! Thanks for the tutorial :)

  • @souhaibbenchaker4824
    @souhaibbenchaker4824 Před 4 měsíci

    For the movement with the camera, you can project the right/forward vector of the camera on to a plan with a normal that is negative of the gravity direction then normalize it.
    Also is there a way to use this new node with something other than a pawn? For example a mesh that has simulate physics enabled? That would be soo cool!

  • @present_artist1033
    @present_artist1033 Před 4 měsíci +1

    Really cool! How might you detach back to the ground?

  • @Foolsjoker
    @Foolsjoker Před měsícem +1

    This does not work for first person view. The camera doesn't rotate with the mesh (at least for me it doesn't), which attaches backwards to the sphere. As seen in the video. Leaving the player looking down their own neck or head.

  • @kemo_l7350
    @kemo_l7350 Před 4 měsíci

    Good luck with the new version of gravity systems

  • @нашкрасныыйсоюз
    @нашкрасныыйсоюз Před 4 měsíci +1

    how can I do that the camera follows, and if I am on the other side of the how do I it that my camera isnt upside down

  • @fhajji
    @fhajji Před 4 měsíci

    Finally Custom Gravity! Thank you so much for this video. Could you also make a tutorial on custom gravity inside an O'Neill Cylinder?

    • @Eric_Heberling
      @Eric_Heberling Před 4 měsíci

      I 2nd that motion.

    • @CruelCrusader90
      @CruelCrusader90 Před 3 měsíci

      i think you can get this result by multiplying the field vector by -1. this way instead of pulling you in it would send you out.
      im new to UE and havnt tested it, but that's my assumption. >.>

  • @user-co9vh5iq3w
    @user-co9vh5iq3w Před měsícem +1

    ryan layey i need help for first person chacter controls and also camera rotation

  • @FirewizardJGaming
    @FirewizardJGaming Před 19 dny +1

    You said there's another video after this one that you can do with other shapes than spheres where is that by chance? If there's not a video than can you by chance tell me how to use a cube or other shape than a sphere?

  • @user-fd4nq8ej4n
    @user-fd4nq8ej4n Před 4 měsíci

    WOW!!! This is really great! Thank you so much! It's so cool! But how can we make the character's animation more natural when the gravity switches? Right now it looks more like the character changes position instantly, how can we give the character a smooth rotation?

    • @OliHannah-mg8bq
      @OliHannah-mg8bq Před 2 měsíci

      Did you ever figure this out? Is there some sort of decay function to the gravity value from old to new? Would lerp work?

  • @TheGamingExpert
    @TheGamingExpert Před 21 dnem

    How would I go about making it so the camera orients with the player?

  • @MikhailHudon_ZerithFarron
    @MikhailHudon_ZerithFarron Před 4 měsíci

    so this is essentially a quick native way to get something akin to Sonic wall and ceiling running?

  • @elcid2651
    @elcid2651 Před 4 měsíci

    I haven't downloaded 5.4 yet, but I'm a bit skeptical that this carries over to ragdolls. Will this work on non-Character class physics objects, I wonder?

  • @xiaoyuwang9940
    @xiaoyuwang9940 Před 4 měsíci

    Hello, I followed your video and have a question about the Event ActorEndOverlap section. Why do we first check if the actor's class belongs to BP_GravityField, and then use the Cast Failed pin from the Cast To BP_GravityField node? Aren't both of these steps for clearing the Current Gravity Field when the overlapping actor is not a gravity field? Thank you so much!

  • @kemo_l7350
    @kemo_l7350 Před 4 měsíci

    How do I make zero gravity Eva spaceman mechanics?

  • @carlosrivadulla8903
    @carlosrivadulla8903 Před 4 měsíci

    How do you see the new nodes added in each release? They are not included in the note patch.

  • @a.s.b.
    @a.s.b. Před 3 měsíci +1

    will this work for any physics object?

    • @RyanLaley
      @RyanLaley  Před 3 měsíci

      No only characters. For physics you basically have to do it old school add make your own physics code to allow gravity in different directions

  • @thijsbouma8818
    @thijsbouma8818 Před 2 měsíci +1

    i did get this to work, but when i go into multiplayer one of the characters(the server displayed on the client side) movements is broken. it only is when i set the gravity other than 0,0,-1. is there something i'm doing wrong?

    • @JonSkov-DK
      @JonSkov-DK Před měsícem

      Yeah, it seems like only the location of the capsule component is replicated as default, but not the rotation - I'm stuck on the same issue.
      Edit: You can check the Ignore Base Rotation in the Character Movement Component. Unfortunately though this seems to work, it generates other issues.

    • @thijsbouma8818
      @thijsbouma8818 Před měsícem

      @JonSkov-DK I don't think we experience the same error. The rotation is replicated correctly and on the server side the movement of the cliënt works pretty good, but if I play as the server or a second cliënt, then the movement is very jittery and the character seems to be falling and landing continuesly. I haven't found a solution yet.

  • @WarWulf778
    @WarWulf778 Před 4 měsíci

    I could have used this when i was developing my first game. It was an asteroid survival game lol

  • @fogbyhedgehog
    @fogbyhedgehog Před měsícem

    Hello! Someone can say me, please, how i can disable gravity? I know about "gravity scale" in character movement settings, but it's not good because 0,0 gravity scale also disable collision of my character. I'm just want that my character will move on z-axis (up/down) and not fall because gravity. I know about flying mode, but because gravity my character fall. Flying mode good work for jump, but not clear fly. I want move my character up on z-axis and that he will stay on location when stopped movement. Thanks

  • @ShineLouder
    @ShineLouder Před 2 měsíci

    is it replicated

  • @boombyte8849
    @boombyte8849 Před 4 měsíci +2

    Biggest problem with this--there are no nav mesh for that.

    • @christopheaurelie6943
      @christopheaurelie6943 Před 3 měsíci

      AI Gravity Bot Navigation ; it's just a basic one but if it can help you in your projects ;)
      czcams.com/video/5lY5hI2FMVo/video.htmlsi=6kPuCWmYD0axf0Ys

  • @jllarivee60
    @jllarivee60 Před 2 měsíci

    Damn these deprecated movement inputs. Im over hear dealing with InputMappingContext.

  • @keithcollier4860
    @keithcollier4860 Před 4 měsíci

    Well.. thats awesome! As much as I hate flip-flopping between engines, looks like I'm going to need to test run UE some more.

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

    I've been wanting to implement gravity for a long time. If this is only possible on 5.4, then should I move the project from 5.1.1?

    • @MgamingStudios
      @MgamingStudios Před 4 měsíci

      You should be ok trying to implement this system I’ve followed some tutorials that were using 4.27 and older and I haven’t had any issues

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

      @@MgamingStudios I watched a video from CodeLikeMe and he uses C++ there. This doesn’t suit me at all, I just broke my project (it’s good that I like to make backups)
      The rest of the tutorials don't work, or they work very sadly. So I'm thinking about moving the project to a new version of the engine when it's stable

  • @caelumspartas8085
    @caelumspartas8085 Před 28 dny

    Can I use this with ai?

  • @thefuppits
    @thefuppits Před 4 měsíci

    Thank you Ryan!