# How to make realistic sliding physics down a slide?

Hi all,

I am looking to create a slide, but didn’t want to make a basic one which just sits you down at the top and you randomly bounce down the slide with no realism in the way the character goes down whatsover, such as in most waterpark games on roblox currently.

The way characters slide in Water Park World by @Den_S looks very realistic, how the character stays on the slide but also change speed depending if there is a drop or turn.

I had the idea to tween a part between many points along the slide to make it smooth, but with how the TweenService works, the speed of the part was constant as it went down the slide, no matter the angle of the drop. I could manually code the tween between each brick through trial and error to make it speed up and slow down, but this would become increasingly more time consuming depending on the length of the slide.

This is the result of tweening a part (seat) down the slide.

Would anybody be able to help with achieving a similar result to Water Park World, with getting the player to stay on the slide but still taking physics into account as the player travels down the slide?

I think you should make the tween go fast once you hit the parts which are downwards.
It just creates extra detail.

How are you building the slides in the first place? They look like they’re being generated from some kind of curve, maybe a bezier?

Can you use that same curve to define the path the player takes?

Another simple option could be to place an invisible ball at the top of the slide, make it only collide with the slide and nothing else, and have it roll down the slide. Every render step you could then set the player’s position to the ball’s and their direction to be in the direction of the ball’s velocity. Just a physics-based suggestion.

1 Like

I’ve looked at your text, so i’m guessing to make it like this. I’m guessing if you do it between each part. But you make it less timeconsuming by making the start point name point 1 and last point named point…" Amount of point you gonna have" Then you can use a for loop going from point 1 to the last one. Making it so once you’ve reached point 1 it will tween you to point 2 and so on.

Thank you. I already do this, however if I had to input the time the tween should take based on velocity, angle of drop etc… that would be the part that was time consuming. The way it currently works is with a for loop, but like I said previously, this has one speed between all parts which doesn’t take into account any sort of angle of velocity you may have already going into that part.

I used the Archimedes plugin to make the shape of the slide out of Semi-Circle unions that I made from cylinders and just negated the inside so it was a hollow trough.

The ball idea sounds like it may work quite well for the slide above, or other ones that are straight, however I’m not sure this would ‘bank’ (go up the side of the slide) if you went round a corner, like in the Water Park World video in the original post?

I did wonder about using pathfinding, but not something I have much experience with so was unsure what results it may produce.

1 Like

I’m guessing the best way is physics then.

It sounds like it at the moment.
Ideally I was looking for a way to be able to ensure the ‘ride experience’ is the same everytime, hence why I used tweens originally, but like mentioned, they do not alter in speed as the angle of drop changes. Like I mentioned in the post above, I’m not sure the Sphere method would deliver the most desired experience compared to the one in Water Park World (WPW), such as going up the walls as it travels round corners. Thank you for your suggestion, and if I cannot find another solution I might end up using it, if it turns out to be the best suggestion :).

you might be able to have the player sit down at the top of the slide and topple around ramdomly as you mentioned above, but you play an animation when you start sliding (you might be able to do this with the tweenservice)

Would that take into account the physics though? The way a player slides down with the method of sitting them down and just letting them randomly go down the slide is exactly right from a physics point of a view and how I’d like it to be, however the players orientation needs to be facing the right way the whole time and the player essentially needs to be ‘stuck’ to the path of the slide instead of lifting off randomly.

I was wondering if there was something that would allow physics to just drag the player down the slide, whilst I can ensure that the player is always on the slide so it is a smooth experience.

the way i would do this is

1. set the characters humanoid State to Physics using ChangeState
2. play the sliding animation
3. use a AlignOrientation to keep the humanoid upright and facing in the direction of there velocity

Would you possibly be able to provide some parts of the code for this? I haven’t used any of the functions above, and have only been scripting for about a year so still on the learning curve with more complex things.

I believe you would set the state type in Local Script, mine is inside StarterCharacterScripts, using this line of code?

``````game.Workspace.PCHDB.Humanoid.ChangeState = Enum.HumanoidStateType.Physics
``````

Would simply sitting the player work in place of an animation? Or would it have to have the animation in order for it to end up how I intend?

And finally, I understand the example in the video for AlignOrientation, but what would I orient the player to and get it to be facing the direction of the velocity?

This sounds like it’ll be the perfect solution once I get it working, so thank you for your contribution and hopefully you’ll be able to help getting it fully working as intended :).

This is very old now but I’d be interested in knowing further how this works too. Could you give an example of how AlignOrientation would work here? Thank you

this video shows how AlignOrientation would work

Thank you for the example, but I’m still struggling to understand how I’d make this work in the context of a slide. Could you give me some assistance in how I’d keep the character upright while going down the slide, please?