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

How Can I Make this Movement more Fluid?

Asked by 4 years ago
Edited 4 years ago

So, in short, this script allows the player to control the velocity/movement of a part. The problem is that it is quite choppy - all of the changes in velocity are instantaneous and abrupt. I want it to be more fluid, with a little deceleration or something when the rotation changes. Is there an easy way to do this with BodyMovers or something? Here is my current code, which causes the abrupt turns and such.

bodyVelocityPath = script.Parent.BendingPower
bodyVelocityPath.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
local player = game.Players:FindFirstChild(script.Parent.PlayerName.Value)

player.PlayerGui.MousePosition:GetPropertyChangedSignal("Value"):Connect(function()
    local curr_pos = player.PlayerGui.MousePosition.Value
    local mouse_target_name = player.PlayerGui.MouseTarget.Value
    if mouse_target_name ~= script.Parent.Name  then
        bodyVelocityPath.Velocity = CFrame.new(script.Parent.Position, curr_pos).LookVector * 70
    else
        -- i'm not too sure what to put here, but this seems ok...
        bodyVelocityPath.Velocity = CFrame.new(script.Parent.Position, script.Parent.Position + script.Parent.CFrame.LookVector * 15).lookVector * 70
    end
end)
1
im not sure which body mover this can be done with but bodyvelocity is an instant changer, for fluid changes you dont use bodyvelocity Gameplayer365247v2 1055 — 4y
0
what is MousePosition? megukoo 877 — 4y
0
The coordinates of where your mouse is in 3D space. corncob567 275 — 4y

Answer this question