How would you implement sliding?

I am having a surprisingly hard time figuring this out. I’d like to add sliding akin to Mirror’s Edge or Far Cry where you can press control while sprinting to slide like a baseball player.

The controls are fine, I just can’t figure out a solid way to implement this so that the character moves faster downhill and slower uphill. Ideally I’d just use physics to carry the character but the proper method is eluding me. Here’s what I’ve tried

  1. Launch the character and reduce their ground friction - this appears to work, but if you’re going downhill you just launch straight forward.

  2. Add physics to the capsule - this causes the capsule to topple over and flip around on the ground (hilariously). I tried locking certain axis of movement but everything seems to result in the capsule flying around on the floor. I want the capsule to stay upright while being affected by gravity.

Is there some way to make the character move downhill like they are in some kind of vehicle/snowboarding/whatever?

You’re asking two things here. Sliding is easy, you just store the rotation of your character in a variable at the begininng of the slide, disable character controls while sliding, use a timeline to add movement input throughout the sliding action and use the same timeline to enable character controls when finished.

For the second one, you trace a line to the ground from your cahracter and get the hit normal. From that, you deduce the ground slope and add movement accordingly.

1 Like

Cheers! This got me on the right track. I made a couple modifications to your solution, I used a recursive gate rather than a timeline so the player can slide downhill as long as they have momentum. I’m tempted to make a youtube video about it once I fine tune it a bit more, because there’s kind of a lot involved in this actually.

I would be very interested in seeing your blueprint setup for this as I am looking into the same thing right now :slight_smile:

Would love to see a youtube tutorial of this please!

I will put a video up here in a day or two if I can find time, school is really getting in the way of my game dev… Sorry guys, I’ll post again when I can. If you guys want to do my computer engineering homework for me I can work on it right now haha, but, yeah, bear with me.

that video tutorial or a screen of the Blueprint would be really helpful for me >_< will you upload it ?

Double! Anything on this would be lovely!

Here is a preview of sliding system I have implemented in a tutorial. everything is done in blueprints, so not hard to understand

308106-slide-1.gif

You can watch the full tutorial here. [unreal sliding system][2]