I’m making this melee combat system and I want the player’s character to be pushed in their move direction during a swing. Here is my reference. The game is called Balthazar:
It feels awkward and unsmooth compared to Balthazar. I’m confused on what they are doing to make their push so smooth. Are they using some sort of velocity, or are they tweening the walk speed?
If anyone can help me, it would be greatly appreciated.
Since no solution was marked, I’m assuming this still hasn’t been solved. Solution 1
As CoopJava said, you can instance a LinearVelocity into the player, and have the Attachment0 property to the player’s RootAttachment, located in the HumanoidRootPart. Whenever the player makes a “swing”, set the velocity (VectorVelocity) of the LinearVelocity as the humanoid’s MoveDirection (a property in the Humanoid). I should note the LinearVelocity’s “Enabled” property should be set to false, and only enabled during a swing. Solution 2
This solution is relatively similar to the previous one, except it doesn’t use LinearVelocity. (And may be more optimal) On a BasePart, there is a function called :ApplyImpulse() which allows you apply a force on the part. Using this, you can use the :ApplyImpulse() on the player’s HumanoidRootPart using the player’s move direction.
Here’s an example of how you would do that.
Character.HumanoidRootPart:ApplyImpulse(Humanoid.MoveDirection * 100) -- Replace 100 with the needed velocity.
If there are any errors with anything I said make sure to tell me!