How To Allow LinearVelocity Take Consideration Of Gravity?

I am changing my dash from BodyVelocity to LinearVelocity, as BodyVelocity is deprecated to LinearVelocity. The only problem is that LinearVelocity make your character float while dashing. I have not found any solutions regarding this, so any help is appreciated.

Change the VelocityConstraintMode to Line, change the line direction, and update the line velocity.
Ex:

------------------------
-- PREVIOUS LINEAR VELOCITY
------------------------
local originalLinearVelocity = Instance.new("LinearVelocity")

-- Obviously set up attachments

originalLinearVelocity.VectorVelocity = Vector3.new(0, 0, 5)


------------------------
-- UPDATED LINEAR VELOCITY
------------------------

local newLinearVelocity = Instance.new("LinearVelocity")

newLinearVelocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Line
newLinearVelocity.LineDirection = Vector3.new(0, 0, 1) -- b/c initial vector velocity moved on the Z axis

newLinearVelocity.LineVelocity = 5

And if you wanted the linear velocity to also work on the X axis, then you would switch the constraintmode to plane velocity.

I had the same issue. Setting LinearVelocity.ForceLimitMode to Enum.ForceLimitMode.PerAxis and then LinearVelocity.MaxAxesForce to Vector3.new(math.huge, 0, math.huge) solved the problem for me. Do note that the Linear Velocity will completely override the velocity of the player character on the X and Z axis.

local linearVelocity = Instance.new("LinearVelocity")
linearVelocity.ForceLimitMode = Enum.ForceLimitMode.PerAxis
linearVelocity.MaxAxesForce = Vector3.new(math.huge, 0, math.huge)

linearVelocity.VectorVelocity = rootPart.CFrame.LookVector * dashMult

You can use VectorForce instead:

VectorForce.Force = vector.create(0,workspace.Gravity*HumanoidRootPart.AssemblyMass,0)

Also make sure its relative to workspace mode

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