#Is there a better way to do this

1 messages · Page 1 of 1 (latest)

arctic thistle
#

Surely there is yeah? i am trying to make the movement of the enemy smoother by lerping but lerping has inconsistent speeds and also makes the enemy move really slowly. I am doing this repeatedly in a heartbeat function

gentle copper
#

Lerping shouldn't be necessary if you're multiplying by delta time, which you are. What is "not smooth" about the movement, can I see a gif

arctic thistle
#

Wiat

#

ill get a gif later

arctic thistle
arctic thistle
#

i dont have a gif unfortunately

#

but by "not smooth", i mean that it snaps to the position

#

lets say it changes elevation, itll just snap to the ground instead of smoothly falling

gentle copper
#

Maybe instead of relying on collision to stop the fall then you could apply some counter force against falling when you're a certain height from the ground so it appears smoother. Lerping is always gonna end up slower because it's approximating

#

I guess instead of using constant speed, which is inherently snappy because it's constant, you could apply force calculation with a maximum velocity limit

#

so just do basic acceleration for the position instead of constant speed, you can write to an attribute for velocity, or use roblox's deprecated Velocity or however you wanna handle keeping track of it

arctic thistle
#

but this doesnt use physics

#

it checks elevation by raycasting and then changes accordingly

#

it moves by cframing itself

#

so it doesnt really "fall", it just snaps to the ground

arctic thistle
#

bump

gentle copper
#

What I was really suggesting is basically that you completely do away with the constant speed approach because it's inherently snappy and do custom physics

#

If you just want it to not be snappy when you're detecting the ground, you should go about aligning to the ground differently. Move faster if you're above the ground a decent amount, "decelerate" when you're within stopping range. Would probably only do that for falling motions and not for rising motions, snappy should be fine if it's going up an incline

arctic thistle
#

hmm