No matter how I rotate the velocity just won’t go in that direction. What’s wrong?
SwimForce.VectorVelocity = Root.CFrame.LookVector * SwimSpeed
No matter how I rotate the velocity just won’t go in that direction. What’s wrong?
SwimForce.VectorVelocity = Root.CFrame.LookVector * SwimSpeed
This makes me question why they deprecated BodyVelocity / BodyPosition since that was easier to work with. Why doesn’t this work?
local function SetLinearVelocity(Part, MaxForce, Velocity)
local LinearVelocity = Part:FindFirstChildOfClass("LinearVelocity")
if not LinearVelocity then
LinearVelocity = Instance.new("LinearVelocity")
LinearVelocity.Parent = Part
end
if not LinearVelocity.Attachment0 then
local Attachment = Instance.new("Attachment")
Attachment.Parent = Part
LinearVelocity.Attachment0 = Attachment
end
LinearVelocity.MaxForce = MaxForce
LinearVelocity.VectorVelocity = Velocity
end
for i = 1, 100 do
wait(.1)
SetLinearVelocity(script.Parent, 10000, Vector3.new(0, i*5, 0))
end
I think I understand that part, but like if I change it to this Vector3.new(0,0,i*5) you’d think that the velocity would move in wherever my characters facing but it’s not doing that.
Actually nvm it works but for some reason it wants to go backwards lol?? Roblox made some weird new bodymovers… I could just make it negative though and maybe it’ll go straight.
It’s also kind of buggy and sometimes i glide to the left before the whole acceleration starts up… I don’t really understand this bodymover very much tbh
try this in an empty baseplate as a localscript under startercharacterscripts
it should go straight
local HumanoidRootPart = script.Parent:WaitForChild("HumanoidRootPart")
local function SetLinearVelocity(Part, MaxForce, Velocity)
local LinearVelocity = Part:FindFirstChildOfClass("LinearVelocity")
if not LinearVelocity then
LinearVelocity = Instance.new("LinearVelocity")
LinearVelocity.Parent = Part
end
if not LinearVelocity.Attachment0 then
local Attachment = Instance.new("Attachment")
Attachment.Parent = Part
LinearVelocity.Attachment0 = Attachment
end
LinearVelocity.MaxForce = MaxForce
LinearVelocity.VectorVelocity = Velocity
end
while true do
for i = 1, 10 do
wait(.1)
SetLinearVelocity(HumanoidRootPart, 100000, (HumanoidRootPart.CFrame.LookVector*10*i) * Vector3.new(1, 0, 1))
end
SetLinearVelocity(HumanoidRootPart, 100000, Vector3.new())
wait(2)
end
https://gyazo.com/2bc745c72668343d3686eb07f6e0d0ba
I don’t understand… Why is it so difficult just to make the character move in the direction theyre facing
local SwimForce = Instance.new("LinearVelocity")
local SwimAttachment = Instance.new("Attachment")
local wPressed = false
local RunService = game:GetService("RunService")
local SwimSpeed = 0
local MaxSwimSpeed = 20
local Player = game.Players.LocalPlayer
local Root = script.Parent:WaitForChild("HumanoidRootPart")
local Hum = script.Parent:WaitForChild("Humanoid")
Hum.WalkSpeed = 0
SwimAttachment.Orientation = Root.Orientation
SwimAttachment.Parent = Root
SwimForce.Attachment0 = SwimAttachment
SwimForce.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
SwimForce.Parent = Root
SwimForce.Enabled = false
SwimForce.MaxForce = 10000
local TS = game:GetService("TweenService")
local SwimForceInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0)
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input, processed)
if not processed then
if input.KeyCode == Enum.KeyCode.W then
wPressed = true
end
end
end)
UIS.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.W then
wPressed = false
end
end)
RunService.Stepped:Connect(function()
if wPressed then
SwimForce.Enabled = true
local Direction = (Root.CFrame.LookVector*10*SwimSpeed)*Vector3.new(1,0,1)
--local Track = TS:Create(SwimForce, SwimForceInfo, {VectorVelocity = Direction}):Play()
SwimForce.VectorVelocity = Direction
if SwimSpeed < MaxSwimSpeed then
SwimSpeed += 1
end
else
SwimForce.VectorVelocity = Vector3.new()
end
end)
Shouldn’t this be relative to world since part CFrame look vector is a world space vector?
The example works fine, implement it and and find out whats different in yours
Same thing happening to me rn. Fr questioning why they deprecated Body Velocity. It was so easy to work with
No matter what I do, my character wont go forward. It just keeps turning to every direction BUT forward