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 I don't know how to share screenshots on TH-cam 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!
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!
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. >.>
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!
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?
How can I implement this into a large world with multiple planets? I tried using it but you have to collide with the planet for it to work the best. But if you say go to the bottom of the planet then you just fall away from the planet unless you start off touching the planet. How can I fix this?
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
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?
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!
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?
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.
@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.
AI Gravity Bot Navigation ; it's just a basic one but if it can help you in your projects ;) th-cam.com/video/5lY5hI2FMVo/w-d-xo.htmlsi=6kPuCWmYD0axf0Ys
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?
@@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
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.
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?
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.
Ryan, We NEED a part 2 drastically! I have been playing with the blueprint but am having issues returning the player character to the main landscape!
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.
Hello, I designed a similar system too on my project. Can you share blueprint screenshots if possible?
@@kkayaoglu I don't know how to share screenshots on TH-cam 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!
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!
This is perfect, ive been playing gravity rush 2 recently and have been feeling inspired a bit
Thank you man, was hard to figure out for me, much appreciated !
This is awesome I planned on make a space based game soon 🙌
Great video. I'd be interetsed in inverse gravity. Like in a space wheel, cylinder or ring world.
Looks really dope!
Really cool! How might you detach back to the ground?
Finally Custom Gravity! Thank you so much for this video. Could you also make a tutorial on custom gravity inside an O'Neill Cylinder?
I 2nd that motion.
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. >.>
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!
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
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?
This would help a lot
How can I implement this into a large world with multiple planets? I tried using it but you have to collide with the planet for it to work the best. But if you say go to the bottom of the planet then you just fall away from the planet unless you start off touching the planet. How can I fix this?
Can you use a spring to tether the camera while up against objects of a certain class?
How would I go about making it so the camera orients with the player?
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
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?
Did you ever figure this out? Is there some sort of decay function to the gravity value from old to new? Would lerp work?
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!
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.
so this is essentially a quick native way to get something akin to Sonic wall and ceiling running?
will this work for any physics object?
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
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?
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.
@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.
Biggest problem with this--there are no nav mesh for that.
AI Gravity Bot Navigation ; it's just a basic one but if it can help you in your projects ;)
th-cam.com/video/5lY5hI2FMVo/w-d-xo.htmlsi=6kPuCWmYD0axf0Ys
Damn these deprecated movement inputs. Im over hear dealing with InputMappingContext.
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?
How do you see the new nodes added in each release? They are not included in the note patch.
Thank you Ryan!
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?
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
@@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
Can I use this with ai?
Not with a standard nav mesh
But without a behavior tree, absolutely.
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.
ryan layey i need help for first person chacter controls and also camera rotation
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?
Camera --- get world rotation --- break rotator(z) --- (z)make rotator --- get forward vector / get right vector
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.
is it replicated
How do I make zero gravity Eva spaceman mechanics?
Good luck with the new version of gravity systems
I could have used this when i was developing my first game. It was an asteroid survival game lol
Cool new feature! Thanks for the tutorial :)