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

bodyvelocity goes beyond determined area?

Asked by 5 years ago
1while true do
2script.Parent.BodyVelocity.Velocity = Vector3.new(0, 0, 30)
3wait(0.4)
4script.Parent.BodyVelocity.Velocity = Vector3.new(0, 0, -30)
5wait(0.4)
6end

i have a part that goes back and forth with this bodyvelocity script and eventually the part starts inclining towards left movement and starts moving away.

1 answer

Log in to vote
1
Answered by
Fifkee 2017 Community Moderator Moderation Voter
5 years ago

Issue 1

Wait Variety

Wait has slight variation (usually by less than .1 but sometimes even greater than .1) that can severely augment motion relative to the power. Here's a benchmark to portray my point:

1> for i = 0, 5 do print(wait(.4)) end
20.4171000085189 89957.999667175
30.41501538603916 89958.42369611
40.48972055107879 89958.623071992
50.40863880743564 89959.320959442
60.41707751963986 89959.652201172
70.59647238685284 89960.073167889

Issue 2

Physics

A BodyVelocity does not instantly negate a part's velocity. It constantly adds that velocity per the power & dampening factor of a bodyvelocity, so it will take time for the velocity to zero out and then move in the correct direction. If anything, the part should be slowing down before it moves in the other direction.

hello, i'm here to collect my rep (upvote pls <3)
0
up voted royaltoe 5144 — 5y
Ad

Answer this question