Player losing all velocity mid-air

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    I am making portal-like game and obviously your velocity should save through portals
    And I want my character fly like this brick( AssemblyLinearVelocity applied |0, 100, -100| )

  2. What is the issue?
    Issue is player just stops mid-air! (Same AssemblyLinearVelocity applied as for brick)


    Note: it’s not weight, if I enable Humanoid.Sit then it flies perfectly how needed.

On this image Red line is rough trajectory that should player follow; Yellow - rough actual trajectory that player follows

  1. What solutions have you tried so far?
    I tried to find solution on DevHub, but the only option I found is enabling Humanoid.Sit, but obviously this doesn’t work for my game.
    I am not expecting someone to write 500 line script for me. I want to get ideas for the solution, my current idea is to do trickery with mover constraints(especially VectorForce)
2 Likes

I’d look into the HumanoidStateType:

Try changing the character’s state to Physics midair.
When you touch some ground/wall, make sure to unset it!

Let me know if that works :stuck_out_tongue:

1 Like

Hey, that may be one of the solutions, I’ll work on wall detection and tell you the result.

1 Like

Yes! You can use raycasting to check in all directions around the player, every frame, using a heartbeat. Let me know if you need help with that. :smiley:

1 Like

Probably because the Character weighs significantly more than the part and has a more dramatic effect being pulled down by gravity.

I suggest using a BodyVelocity, it will allow you to control the exact speed of the character irrelevant to it’s weight

(Or if you want to use the new BodyMovers and don’t like legacy BodyMovers you can use VectorForce)

1 Like


It is kinda the result, but sure will need to do rework it. Physics state is an unstable solution to a problem, because at 1 attempt I just flew out of the portal in random direction all spinning, so will need to work with VectorForce.
I think I’ll work with BodyVelocity instead

No weight is not the problem. If I enable Humanoid.Sit then it flies perfectly how needed. Problem is that Velocity just zeros out at one point without and all what remains is velocity from gravity.

Alright! I see then.

The reason you flew out, is most likely related to Roblox collisions, not the Physics state.

What Physics state does is, it enables the same state as Humanoid.Sit. The only difference is, it does so indefinitely, while sit, ends after a certain time, removing the Physics state, and that’s why the Velocity zeros out. I’m quite sure the Physics state is what you are looking for if you want to preserve velocity, acc etc, but the collisions problem is different. I’d recommend not using Touched events if you use any!

You can work with BodyVelocity as well, but I believe it will not have the effect you want. BodyVelocity will impose some velocity on the character, it will not conserve some random previous velocity you had before entering the portal.
What you can do is register the exact velocity magnitude your character has, and after teleporting, set that same velocity using a BodyVelocity, but problem is in which direction? If you just use the exit portal’s normal (aka look vector), it might not behave as intended in all scenarios. But I guess you can give it a try :stuck_out_tongue:

Ok, so good news I managed to do that. Did some trickery with mass and velocity. But it work(I hope). There is video in the tweet.

Hi! Is there a possibility for you to publish the code of how you did that? I’m looking everywhere on how to do it. Can’t find a solution, and I tried a lot of ways.