Ways to get Linear Velocity working like body velocity?

Heyo!

Ive been working on this script for a long time, the script is supposed to replicate Inertia (i think its called that), what the script does it is makes you keep moving after jumping, they only stop moving when they land, also a feature of the script was that you could trimp, like in that roblox game evade, and i still want that.

basiclly you keep moving in the direction you jumped in until you land.

the scripts way of moving the player was with body velocity, but thats deprecated now, so i need an alternative, Linear Velocity does the best job at moving the player but they stay in motion forever and never come down, the player just floats up.

( the player is supposed to go up for a little bit then fall back down, like in reallife.)
(duh)

is there any way to make the player come down after jumping? or is there any alternatives that work like body velocity and could work like this?

any help would be greatly appreciated.

edit: I can also supply some of the script if you want to see it.

2 Likes

Please specify what you mean by “simulating inertia”.

i did say that i think its called inertia, what im trying to do is when the player jumps, they will keep moving in the direction they have jumped in until they land.

Hi people!

I have solved the issue and its no longer a problem.

if you really want Linear Velocity to work like Body Velocity, it is quite simple.
heres the little code to get it to kind of work like Body Velocity:

--Variables
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart: BasePart = Character:WaitForChild("HumanoidRootPart")
local Humanoid: Humanoid = Character:WaitForChild("Humanoid")
local Attachment = Instance.new("Attachment")
local Velocity = Instance.new("LinearVelocity")
--Setup
--[[
the code down here makes it so the attachment is attached to the HumanoidRootPart,
then makes the velocity attached to the attachment.
--]]
Attachment.Parent = HumanoidRootPart 
Velocity.Parent = HumanoidRootPart 
Velocity.Attachment0 = Attachment
--[[
the code down here makes it so you can use MaxAxesForce, instead of MaxForce.
MaxAxesForce is a Vector3, while Normal MaxForce is a number.
MaxForce makes so X, Y and Z all have the same MaxForce as you put in,
so its the same MaxForce in all directions.
using MaxAxesForce allows for more possibilitys and coding freedom.
--]]
Velocity.ForceLimitMode = Enum.ForceLimitMode.PerAxis
Velocity.ForceLimitsEnabled = true
Velocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector

--[[
moving the part is very easy.
--]]

Velocity.MaxAxesForce = Vector3.new(0, math.huge, 0) -- setting the max force
Velocity.VectorVelocity = Vector3.new(0,9999,0) -- the velocity that makes you move

--[[
quick note, setting max force to really high numbers can cause some glitches sometimes.
also you can still use MaxForce, doing all this just allows for MaxAxesForce to work.
--]]

Hope i could help a little bit.
Bye!

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