Hi, I’m working on a dashing system right now and I got it working mostly using LinearVelocities, but I want to add something else to it that I can’t figure out how, this is it.
When you press shift you dash, and you move at a certain speed for a certain small amount of time. This means the dash will be at least x amount of studs long.
But after that threshold, the force applied stops, so I want to make it so if you don’t do anything and just dash normally, you kind of slide out of it, but if you dash forward, and then say press s or move in other direction, the dash STOPS and you continue normally in that direction.
How would I do this? I already tried after using LinearVelocities, switching over to VectorForces, which apply a constant force no matter what, and then tween the force over a period of time down to create a sliding effect, but that doesn’t work. I don’t want this script be over complicated, but just simple (if possible). I will over complicate if necessary, though.
Also, I want it when in the air to be the same speed on the ground, if I dash off of a platform, after the threshold I don’t want you to be too fast, because to slide a character takes more force on the ground than the air (if you ever noticed).
You can set the player’s velocity to 0,0,0 if you want to stop them from moving. For everything else I got nothing for you.
Edit: I found this post. It might help you.
Thanks for this. There are a lot of good points in that post, like reducing the friction on the ground, and adding a little upwards force on the character to reduce the gravity force.
I tried it myself, but it doesn’t seem to work for me. I don’t see any changes. I just want to make a sliding mechanic. That’s all
You should stick to LinearVelocity during the slide, and tween the LinearVelocity down for a smooth effect. TweenObject:Cancel() will destroy a tween and allow you to set values manually again, which should work for the slide cancel.