Best method of force for a dash?

Hello! I am trying to make a dash system for my game. I don’t really have any code right now because I am trying to figure out the best way to apply the force. I tried using ApplyImpulse() but dashing on the ground barely moves you, but dashing in the air feels perfect. Is there any ways to make ApplyImpulse() ignore the ground friction, or is there a better method of achieving a dash? Thanks!

I used linear velocity and it seems to work

1 Like

BodyVelocity?

I think body velocity is depracated now, it’s linear velocity instead

People are saying to use linear velocity/body velocity. And while it does work it’s not really how either those constraints should be used. Since they’re used to mantain a constant velocity/force. Not an instantenous temporary force. Which is precisely what a dash is.

Applyimpulse should work just fine if you use the formula Force = mass x acceleration correctly whether you’re on the ground or not. But if for whatever that isn’t working. Try using assemblylinearvelocity (However assemblylinearvelocity can as explained by the docs create unrealistic force so take that into account)

Edit: Just tested out applyimpulse right now on a default baseplate using the command bar so sorry for the ugly code but it does work pretty well:

workspace.Amritss.HumanoidRootPart:ApplyImpulse((workspace.Amritss.HumanoidRootPart.CFrame.LookVector * 20) * (workspace.Amritss.HumanoidRootPart.AssemblyMass * 10))
2 Likes

Both can be used, force or constant velocity, depends if you want Y axis to be locked, with force, gravity will be applied if you dash off some edge, while linear velocity remain the same Y axis (that is set) until the velocity is destroyed / disabled

Yeah you can disable/enable linear velocity whenever u want but it’s called linear velocity for a reason.

So what, that does not oppose to my statement, linear velocity just ignores every other force such as gravity

ok

30char30char30char

that does work, however the issue is that when i dash while grounded, the character moves. is there anyway to fix that?

I think you should use AssemblyLinearVelocity and in a localscript (dash replicates to server when you do in localscript) doing it in a server script makes the dash feel laggy

Yeah you can send a raycast utilizing the character’s HRP’s position and -upvector. If a raycast is detected that means the character is grounded and therefore you should not run the code that dashes the character. Otherwise if a raycast isnt detected that maens they’re in the air and you can run the code to dash the player.

Would you know how to do that or do you need some sample code?

I think I could figure it out. However I also want the dash to work while on the ground. When using ApplyImpulse() it doesn’t work while on the ground due to friction. how would i fix that so i move while on the ground?

I tried that. It has the same issue as using ApplyImpulse() It works in the air but not the ground due to the friction

oh you can manipulate customphysicalproperties on your character’s baseparts and then change the friction and frictionweight properties.

1 Like

alright ill try that and ill let you know what happens

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.