ApplyImpulse is too forceful when mid-air

So, I have this problem where if I’m mid-air and I apply impulse, it will fling me more than 2x that I desire. How can I keep the impulse the same even though the player is mid-air?

Example:

2 Likes

The script is just an ApplyImpulse call.

char.PrimaryPart:ApplyImpulse(char.PrimaryPart.CFrame.LookVector * number)

1 Like

This might be because when you’re touching it in the ground, the impulse force loses faster than in the air because your character is being dragged in the ground.

Maybe try to make the impulse weaker and make it aim towards the air a bit.

2 Likes

If you want to apply a consistent impulse to your character regardless of whether they are in the air or not, you can normalize the impulse vector. Normalizing the vector means making it have a length (magnitude) of 1, so it doesn’t matter if the character is in the air or on the ground—the impulse will have the same effect.

Here’s how you can modify your code to apply a consistent impulse:

-- Assuming char is your character and it has a PrimaryPart
local impulseMagnitude = number
local impulseDirection = char.PrimaryPart.CFrame.LookVector

-- Normalize the impulse direction to have a magnitude of 1
impulseDirection = impulseDirection.Unit

-- Apply the impulse with the desired magnitude and direction
char.PrimaryPart:ApplyImpulse(impulseDirection * impulseMagnitude)

By normalizing the impulseDirection vector, you ensure that the impulse has a consistent magnitude of number regardless of the character’s position (in the air or on the ground). This should prevent the character from being flung more than you desire when they are in the air.

2 Likes

That’s a very good idea, but unfortunately it still flings me forcefully when jumping. But I really like your technique, I might use it in the future.

That’s a good idea, I will try it out.

I found another solution. I decided to use LinearVelocity and it’s much more better and effecient.