How can I snap my character to a floor with any given rotation?

Hey guys,

First time posting here. But I’m hard stuck on some issue and seek guidance to how to handle it. Note that I’m relatively new to all of this game development stuff, so if this is a silly question, I’m really sorry. I just hope I can be pointed in the right direction.

So, here we go:
Basically, my project consists of a map with multiple custom gravity fields. I’ve made 2 blueprints for that. One of them is for “room gravity” where you can set up the gravitational pull in any given relative direction (not world direction). And the secondary one “planet gravity” which is pretty self explanatory - pulls everything to the middle of the field.

Here’s a little video I made to demonstrate how they work, so you can get the feeling of it:

To make my character (which is a standard character actor) handle all the rotations and enable it to walk on any surface regardless of its world rotation, I've set its movement mode to "Flying" and set it up to kinda simulate the "Walking" mode of "CharacterMovementComponent". Now, this is all great and works relatively well.

But the issue that I’m encountering now is with moving platforms that also simulate physics. Here’s what I mean:

The platform in this video is moved forward by a thruster. As soon as my character (or any object for that matter) falls on it, the force of that object affects the platform rotation. Which is all fine and how it should be. But as the platform moves forward, my character or any other object just stays at it's own world position (still applying the gravity force).

Meanwhile, if I put my character in “walking” mode, when I jump on that platform, it “snaps” to it. Moving the way the platform moves but does not apply my gravity force anymore. Here’s how that goes:

But, if the platform is rotating more than the “walkable slope” angle, the character falls from it, regardless of my gravity vector, since it’s only taking into account the world Z axis to calculate that. So I can’t really use the “Walking” mode for what I want to do.

So here’s my question: How can I “snap” my character or any other object to a floor with any given rotation? How can I simulate the same “snap” from “Walking” mode to “Flying” mode?

If there’s a solution to this, I think that will fix my second issue with ramps (which I thought wasn’t a big deal, but now that I think of it, they’re connected). As my character and objects do not “snap” to the floors, they will always slide down because of the gravity force applied.

Here’s how that happens:


I really hope you guys can help me on this or at least point me in the right direction.

Have a wonderful day and happy coding.

this game looks awesome! can you get the velocity of the platform thruster as a variable? you can try in your cahracter blueprint, you would probably need some kind of boolean varaible to check if youre on a platform or not, and if you are, then add the platforms velocity to your players position, then set that to the players position in event tick.

oh wow! finally got a response! party all night! drinks on me!


Letting aside the jokes, thank you so much for your input! <3

But I did try to do that and it didn’t really work because my character’s capsule isn’t set to simulate physics. I did try to enable it, but then, because of the gravity force, my character would just tilt and drop to the ground and I can’t seem to be able to make it stand straight. :<

However, since then, I’ve managed to achieve this thing (sort of) by re-parenting my character to the floor it’s standing on. I figured that that way, it will take the velocity of the parent (the floor) into consideration. I don’t really like this solution and maybe on another iteration of this I’ll find how to do it differently. This is also buggy, but for the moment, I’ve let it like this so I can move forward.

Here’s a video of it: trial 'n' error - YouTube

It only bugs out when the platform is moving upwards. Not really sure what causes it, but I have the idea that the capsule overlaps the floor’s collision box and then it checks for collision it says “that’s a no-no”. Meanwhile, if I sit in that chair (which is a little higher from the floor) and then stand up, it fixes it for the moment because my character will keep that small distance from the floor as well.

So, I got to fix that as well.

Thank you so much for your input tho! Means a lot to me! <3

Here’s another video while I was actually having fun with my stuff: look ma'! I'm piloting muh ship! - YouTube :smiley:

Yeah this looks awesome message me when this is done, or if u need help, i wanna play this when its finished https://m.youtube.com/c/vic3vers4games

Did you accomplished this with just blueprints, without any external plugins?

Hi, yup. Only blueprints with no external plugins or C++ actually.

Holy smokes, could you please give me a look on blueprints or a guide/tutorial which you followed? i’ve been searching for so long on how to make something like this for my test project.

Oh man, thank you so much :smiley:
This really means a lot to me

Well, what are you looking for? I got multiple systems in place and each of them are really complex. :slight_smile:

There’s no real guide or tutorial for what I’ve done here. I did research a lot of guides and tutorials, different ways of doing stuff in ue4 through entire pages of text and all, but they are mostly basic stuff. Besides that, I went through trial and error to do everything. Oh, and studied a lot of physics as well and how ue4 reproduces physics and how can I define them for it to do it in a proper way. :stuck_out_tongue:

Anyway, what are you interest in? I can share with you how I did stuff and what was my thinking process and what I got to use to achieve this result. But from there, you’re on your own. :stuck_out_tongue:

Edit: Oh yeah. I forgot about this: Disclaimer: This is currently just a prototype for my game and in no way a final product. Through my development I’ll probably change a lot of the current stuff through the different iterations.

i’m looking just to make player able to walk on walls and ceiling, same as shown here Project demo - YouTube. i’m working on multiplayer FPS project for testing purpose, wrote whole mechanic and net code through blueprints and little c++, but i want to create a map like here: http://moziru.com/images/drawn-mcescher-house-4.jpg not as complex but similar, imagine fast p[aced quake like game with 360 gravity

Alright, I’ll document my gravity fields and stuff and record a video and I’ll give it to you here.

But don’t expect it in the next couple of hours or something. Probably not even today, but I promise to do it by tomorrow at around this hour the latest. :slight_smile:

Hey, finally managed to finish it.

I got a google doc for you, explaining how stuff work and a video.
Here’s the doc: https://docs.google.com/document/d/15SE-9UviwNtzPDeXGKbmEs_hgeXaScpX5HMovUWBrLo/edit?usp=sharing . Couldn’t write here everything, cuz there’s a limit. :<
And here’s the video: Gravity stuff BP Show - YouTube

I’d suggest you read the doc first so you get an idea of what’s going on. Or just go through them at the same time. :slight_smile:

Good luck with it! :smiley:

Thank you so much, please tell me your real name so i can mention you as contributor

Well, all that stuff requires a lot of changing an finishing to be used in a final product. But hopefully will get you on your way. My real name is Bogdan Costea. But if you want to mention me anywhere, you can just use my gaming handler which is “Coxis”.
Otherwise, I don’t actually ask for anything tbh. :slight_smile:

I’m just looking for ways to overcome the issues I meet in my project.

Edit: Oh! I forgot! You’re welcome! :smiley:

Hi Coxi, sorry to buzz you again, but i need your help. Can we have a voice chat?

Either on discord: revan1611 or skype: mike.rich1611