Prevent pawn from sliding on surfaces

Hello everyone,

i’ m fairly new to unreal and i am trying to develop a little space game.

I have a pawn that is able to move around small planets (similarly to super mario galaxy), but i stumbled upon a problem that i’m not able to solve.

to make the pawn stick to the surface of the planet i am using an input vector that point toward the center of the planet, the movement as well as jumping work fine, but as soon as i try to move the pawn above some other flat surface (for example a cube) it start sliding.

it is probably due to a line trace that i use to calculate the player rotation to keep him aligned with the terrain. This line trace ignore every collission except the planet mesh, so i am assuming when i position the pawn above a surface the pawn tries to follow the planet rotation, but because of the flat surface the slide happens.

Is there a way to avoid this sliding?

i will provide some images of my blueprints, or a video of the problem when i will be back home if you guys need it, any help is appreciated!

1 Like

I also have a ‘planet pawn’ ( might have answered before, not sure ).

It works much better if you down trace to the object underneath you, rather than the planet.

That way, you can move around on all sorts of surfaces with no problem.

It really depnds how you have set things up. If you’re using physics as well, it could be tricky…

Thank you for your help, i managed to solve it in a very similar way as the one you suggested!

i tried to trace directly the object underneath me, but doing that way it gave me some problems with my pawn’s camera, because i needed to rotate my camera accordingly with the curve of the planet as soon as i tried to get on an object the camera started freaking out and follow the object mesh too. So i just made another linetrace that tracks everything but the planet, applying as a vector the impact point.

This way i was able to keep the camera rotation i wanted and make the caracter not slide! Not sure if using too many linetraces has some heavy impact on performance but for now i think i will stick with this solution!

Thanks again!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.