#Smooth Velocity Addition...

1 messages · Page 1 of 1 (latest)

wind beacon
#

So i want to make a push/dash that starts out a speed to the direction the humanoidrootpart is facing and slow down with the time. This part i working somewhat as it should and all, but it is not going very smoothly, as i need it to don't affect other speeds such as Y speed (gravity, jumps), and despite the character is falling down, it slows/cancel the Y forces quite a lot...

graceful canopy
#

are you trying to make it like the strongest battlegrounds dash where it has a fast start and then slows until end?

#

@wind beacon

graceful canopy
#

i made this dash system almost 1:1 i while ago i should be able to help you out

#

the difference is that i used bodyposition or bodyvelocity i cant remember

wind beacon
graceful canopy
#

sorry im helping someone else right now

#

the problem here is that i did not use linearvelo

#

but essentially you need to make a local function for velocity decay

#

so it starts with x velo and decays until the dash is done

wind beacon
#

This isn't particularly helpful...

graceful canopy
#

essentailly in the local function make the force you want for the velocity in the dash the duration and then the decay which is the rate at which the force will reduce until the duration time is met

#

so then the dash will start with the force you want and slow down until the dash is done

#

i cant show my code for it as it was for a game

wind beacon
graceful canopy
#

if that is your problem

#

then i would recommend that you watch some code guides on how to use linear velocity as i did my system using body velocity or position but the core code should be the same

#

let me find it

#

the local function should be wrote like:

local startTick = tick()
local currentTime = tick()
you need this for the duration logic of the dash, then you will need local elapsed = currentTime - startTick so you can decay the velocity force of the dash.

local currentForce = force * math.exp(-decay * elapsed)

to decay the dash fully over the duration

#

@wind beacon

#

just apply this

#

to your dash logic already

#

and then build and change your existing dash logic around this

#

you should get the hang of it

#

after

wind beacon
#

i guess...

#

thank you for your time

flint yacht
#

@wind beacon Have you tried using a linear velocity instance with different max forces per axis? That's how I solved my issue with y velocity being cancelled out

cerulean vault
#

omg 1k is crazy

flint yacht