:ApplyImpulse flinging player too far when mid-air

apply impulse pushes player too forcefully if they jump during/prior

no jump:

jump:

code:

	CONNECTION = game:GetService("RunService").RenderStepped:Connect(function(DELTA_TIME)
		---------------------

		if HOLDING_A then 
			DIRECTION = -(workspace.CurrentCamera.CFrame.RightVector)
		elseif HOLDING_D then
			DIRECTION = (workspace.CurrentCamera.CFrame.RightVector)
		end

		---------------------

		if DIRECTION ~= nil then
			CHARACTER.HumanoidRootPart:ApplyImpulse((DIRECTION * 15 * m_(CHARACTER)))
		end
	end)

any help is appreciated

2 Likes

Yeah, that’s just friction.
You can either change it by setting CustomPhysicalProperties or you can move the player via tweens.


Best regards,
Pinker

tweens are gonna suck so badly im just gonna find a way to use linearvelocity instead

That’s the same as applying an impulse, just all the time. Your character will still have friction.


If you don’t like the tweens, you can just use the CustomPhysicalProperties.


Best regards,
Pinker

linearvelocity worked, ty trying to help

1 Like

Would you mind sharing how you got it to work? That’d be interesting I think.
Then you can also mark it as your solution.


Best regards,
Pinker

if you use ChangeState to set the humanoid state to physics before applying impulse then it will fling the same distance when its in the air or on the ground

when you set the state to physics the character will fall over you can use AlignOrientation to keep the character upright while its in physics mode

2 Likes

OP would have just instanced a LinearVelocity into the player character’s primarypart with the velocity in the direction of the jump and removed it after a brief burst.

kinda, i used the same logic for the impulse, i put it in a runservice loop and deleted it after ~0.15 seconds, works the exact same but friction wont slow it down this time

i wouldve done this but roblox does a stupid and makes the character fall onto their face

Why don’t you just add it to Debris?

…thats… exactly what i did though :sob::pray:

game:GetService("Debris"):AddItem("LinearVelocity", 0.15)

Ahh I see, I read it as starting a runservice loop to see if it went past a threshold to delete it :wink:

1 Like

I also recommend setting the bodymover’s velocity to zero (i.e. Vector3.zero) right before destroying it. This was mainly the case with BodyVelocity where there’d still be inertia left even after destroying it, but since LV uses constraints I don’t think that should be the case.