Align character to floor angle

Hi, I’ve been trying to make a 360 movement player (360 movement being that he can move like Sonic) however I’ve faced a problem. I’ve reached the point at which the player correctly sticks to the ground plane he is on however it only works if he is on a ground plane that is less than 90 degrees.

Let me explain how i managed to make this, basically i set the movement mode of the player to flying, i created custom gravity using force, and for the gravity direction, i set the gravity to push the player onto the plane he is on (basically rotate the gravity to match the player’s rotation). I used this for the floor detection:

It worked fine until i reached a plane that is steeper than 85-90 degrees, the player instead of rotating to stand on the plane rotates the other direction.

I have provided a video so you can see what i mean: - YouTube

The clip in the video was slowed down so you can see better the rotation of the player at the top left.

Is this happening because of the rotation code or is it happening due another thing?

I’m pretty bad at vector and rotation math so I really need help with this…

Thanks in advance!

I think it is possible via blueprints only. But the only problem now is that when the impact normal Z becomes negative, the code in the picture above adjusts the player rotation as if the Z is positive. You can see this in the video i provided. I just need a way through blueprints to align the player to the normal of the plane he is on.

this might help. Dynamic gravity for characters - Engine Source & GitHub - Unreal Engine Forums
Actually with BP only I don’t know whether it is possible . There is a whole thread dedicated to this but i am sorry i do not remember who started it or what its name was . if I remember I shall post the thread link too.

Never mind, after a lot of searching i found the answer in this answer hub, i have no idea why it was so hard to come by however here is the link if anybody else needs the same question answered. The player now correctly stays on the ceiling.

It was a thread started by KITATUS. Please do have a look. Glad U found an answer but still surely have a look.

1 Like

I actually am, the link you posted looks very interesting!

This seems to work well for me. Haven’t noticed any issues.

FYI, the yellow line is the Normal from the Line Trace.

1 Like