Hello - I am trying to convert this to use a BodyThrust instead of part's velocity. I have a spring module, that, essentially just returns a velocity. This currently works, but I want to move the last line to the body thrust.
local Spring = require(script.Spring)
local mouse = game.Players.LocalPlayer:GetMouse()
local part = Instance.new("Part", workspace)
part.Anchored = false
local thrust = Instance.new("BodyThrust", part)
local new = Spring.new(Vector3.new(),mouse.Hit.p)
new.omega = 20
new.zeta = 2
mouse.TargetFilter = part
game:GetService("RunService").RenderStepped:connect(function(delta)
new.target = Vector3.new(0,10,0)
new.pos= part.position
new:update(delta)
thrust.Force = Vector3.new(0, workspace.Gravity*part:GetMass(),0)
part.Velocity = Vector3.new(0,new.velocity.y,0)
end) |