Hovering with ApplyImpulse()

Hello devs! I’ve been playing around with :Applyimpulse(), and came across a very weird problem.

For some reason its impossible to create a perfectly balancing part float in the air without falling or rising. Heres my simple test script:


-- part has been set to have a size of (1,1,1) and a density of 1, gravity is 196.2
	part:ApplyImpulse( Vector3.new(0, 196.2 * dt ,0) )

In effect, the part has a natural tendency fall, even though setting it’s assemblyLinearVelocity manually to (0,0,0) causes it to rise very slightly. If anybody has any clue why this happens please let me know!

Thanks in advance :grin:

Hey! ApplyImpulse as its name implies, you are applying an impulse, it also decelerates really quickly, and doesn’t accelerate but directly puts the amount of force you enter in Vector3.

For smooth deceleration, like hoverboard or ice-slide-like stuff, you don’t use applyImpulse.

Consider VectorForce, since it’s a hoverboard-like thing, VectorForce works in my opinion…

Watch this video, this is the best tutorial you can get, because it explains really very well!

How to use VectorForces in Roblox Studio (& Anti-Gravity Effect) - YouTube

Do you need to use applyImpulse? I’m sure there are better ways to go about it. Also, I’m pretty sure ApplyImpulse only works when called by a localScript, so make sure you’re using that.

ApplyImpulse is also a Physics thing, regardless of localScript or Server Script, it doesn’t matter, usually graphics are calculated on the local computers, but CFrames and and positions of parts, they are actually replicated to all clients.

If you want to achieve a client-side only effect, then you should use “ApplyImpulse” on a localScript, if you want everybody to see it, then it should be done on a ServerScript, and if you do it on a localScript plus, the part has NetworkOwnerShip, then that specific client’s localScript applies impulse on a part, the server replicates it to other clients.

ApplyImpulse just applies an Impulse, and impulse means it puts that force you enter in Vector3 onto the target right away, but it also diminishes right away since it’s an Impulse.

Yes yes, I know how ApplyImpulse should work (obviously having trouble with it) but this question isn’t tied to anything important so im not looking for a workaround as mush as why this problem exists.

In your pseudocode, you applied impulse that tries to be equal with gravity, and in that way you tried to cancel out the gravity, am I right?

Try considering the mass of the part because that could be the reason.

Check B Ricey’s video as it might help, that I attached in my previous post.

Maybe this is what you need to do:

-- Mine's pseudocode too
      part:ApplyImpulse(Vector3.new(0, workspace.Gravity * part:GetMass(), 0)

workspace.Gravity multiplied by the part’s mass, and if you multiply that value (which is workspace.Gravity times part’s mass) by 0.5, then it’s half the gravity, if it’s x2, it rises up in the sky, this is not needed but it’s an option in case you need it.

Hope these suggestions help!

Thank you, but in my origonal post there is a little commented section that implies that the mass of the part is set to 1, and because its 1 its not added in the equation. Sorry if you didn’t see that it might be too indirect!

Sorry, there might be a misunderstanding, probably I wasn’t clear

I tested it myself and it works weirdly as you pointed out, it should be due to how both gravity and impulse forces work differently,

Based on my understanding, the ApplyImpulse isn’t able to cancel out the gravity, is this.

  • Apply Impulse simply puts the force onto the part you enter in Vector3, the exact amount of force, Apply Impulse doesn’t accelerate, just puts that force onto the part impusively, doesn’t try to accelerate the part’s velocity.

  • The gravitational constant unlike the impulse force, it is constantly attempting to pull the part down, depending on how long it’s in the sky, gravity force actually accelerates the part’s velocity, but impulse force doesn’t do that.

The takeaway is, gravity is a constant force that continuously accelerates objects downward, but ApplyImpulse applies a single burst of force in a specific direction. It doesn’t continuously accelerate the object, but rather instantly changes its momentum (mass times velocity).

So, the solution in this case is only VectorForce given by Roblox, use that because it accelerates just like gravity as long as it is applying force on it, and thus it cancels out the gravity.

Since you’re just playing out with them, experiment with combination of vectorForce and apply Impulse for fun! Have a great day!


Thanks. I misread the documentation on ApplyImpulse and thought you had to do it on the client for anything not owned by the server.

1 Like