Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I use lerp but base movent on speed not time?

Asked by
AZDev 590 Moderation Voter
8 years ago

I am creating a gun script and wanted to use lerp to move the bullet down range. The problem with this is: Lerp is based on time not speed. This has undesirable affects on bullets. What I mean is: If you shoot at an object that is 1000 studs away the bullet will travel extremely fast to it's target. If you shoot at an object that is 5 studs away the bullet moves slowly to it's target.

I am not interested in using roblox bodymovers as they have undesirable affects on the game itself. ie, Lag.

RayCasting: I've used it, it's great but not realistic. RayCasting will instantly hit a target, unlike a bullet that moves down range before colliding with it's target.

0
This equation is useful for scaling things: value_to_scale / original_amount * current_amount, for example, this scales a health bar based on the amount of health a player has: bar.Size = UDim2.new(1/human.MaxHealth*human.Health,0,1,0) (please note that this may not be useful with lerp, but would probably work when working with making a movement speed of something like a bodymover consistent based TheDeadlyPanther 2460 — 8y
0
@TheDeadlyPanther Thanks I will take this into consideration. AZDev 590 — 8y
5
Downvoted. evaera 8028 — 8y
0
Bullet movement with body movers is easy enough but again, it causes lag. Ray trace is fairly simple my only problem with it is the fact that it is unrealistic. AZDev 590 — 8y

Answer this question