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 4 years ago
while true do
script.Parent.BodyVelocity.Velocity = Vector3.new(0, 0, 30)
wait(0.4)
script.Parent.BodyVelocity.Velocity = Vector3.new(0, 0, -30)
wait(0.4)
end

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
4 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:

> for i = 0, 5 do print(wait(.4)) end
0.4171000085189 89957.999667175
0.41501538603916 89958.42369611
0.48972055107879 89958.623071992
0.40863880743564 89959.320959442
0.41707751963986 89959.652201172
0.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 — 4y
Ad

Answer this question