Hey! So I’ve been looking into this topic for a while but the questions that have asked this before seem to always lead to a dead end, so I want to try asking again but being more direct with trying to ask it to avoid confusion.
The main issue is that the player character’s velocity will come to a screeching halt while mid air as if they were on the ground.
You can test this for yourself in almost any game, get a running start, jump and then let go of your movement input(s) while mid air.
While this generally works well for platforming purposes, I wish to avoid this sort of behavior as I want to keep a sense of momentum in my game.
I also cannot use methods such as platformstand, the physics humanoid state type and the flying state type either as I wish to keep control of other things such as animations, rotation and general player input.
If someone could help me figure out the general approach or what I’d need to do in order to achieve an effect like this I’d greatly appreciate it.
I WOULD LIKE TO RE-ITERATE THAT I AM LOOKING FOR THE METHOD ON HOW TO ACHIEVE SAID TASK AND NOT THE ANSWER, WHILE YOU CAN WRITE OUT THE CODE FOR IT IF YOU FEEL LIKE IT IS NESSECARY I’D MUCH MORE APPRECIATE IF I WAS TOLD HOW SOMETHING LIKE THIS WOULD FUNCTION SO I CAN DO IT MYSELF!
Many thanks to those who offer their support with this and have a nice day!
To fix this in my game I just added a body velocity into the character and set the velocity to the humanoidRootPart velocity and multiplied it by Vector3.new(1,0,1) to stop it from making the player go up or down.
I added the velocity when they jumped and removed it when they hit the ground.
ya so idk if i can test this but i think i have idea
so whilst player not moving then constantly raycast down and if he in air and not moving that mean he freeze
so if that happen then fake the “velocity” by caculate with the raycast hit position on what the humanodrootpart would be if it is on the ground
then after that tween the players huminoidrootpart to the ground and the way u can use speed is using the local Time = math.sqrt((2 * Distance) / game.Workspace.Gravity)
when the player complete tween then unanchor rootpart
Hi! I’m also trying to figure it out. The only idea I have is to try and modify the character’s scripts somehow.
My previous attempt was to take the LOST velocity from the previous frame, and return it back to the current velocity. Worked good. But… you’ll keep your velocity even if you go into a wall.
Which can be avoided by shooting 4 rays in all 4 directions, and if there is a wall, then remove the velocity, but for the game that I’m working on, that won’t work.
I FIGURED IT OUT!
Well, I did so a long time ago. Gonna tell you all now.
Basically what I did, is I gave the player back his velocity, that was lost from the previous frame.
I ALSO had to write extra code to handle movement in air, which makes it “slippery” mid-air. But it works perfectly!