#part levetation
25 messages · Page 1 of 1 (latest)
local part = script.Parent
local Goal = Vector3.new(0,8,0)
local A0 = Instance.new("Attachment",part)
local vecterforce = Instance.new("VectorForce",part)
vecterforce.ApplyAtCenterOfMass = true
vecterforce.Attachment0 = A0
game:GetService("RunService").Heartbeat:Connect(function()
local result = workspace:Raycast(part.Position,-part.CFrame.UpVector * Goal,nil)
if result then
print(result.Instance)
if part.Position.Y < 8 then
vecterforce.Force = Vector3.new(0,20,0)
elseif part.Position.Y > 8 then
vecterforce.Force = Vector3.new(0,-20,0)
end
else
vecterforce.Force = Vector3.new(0,0,0)
end
end)
u fixed but still same result, how its a fix then?
mhmmmmm
but
where u need
it go
?
local part = script.Parent
local Goal = Vector3.new(0,8,0)
local A0 = Instance.new("Attachment",part)
local vecterforce = Instance.new("VectorForce",part)
vecterforce.ApplyAtCenterOfMass = true
vecterforce.Attachment0 = A0
local kP = 0.5
local kI = 0.1
local kD = 0.1
local integral = 0
local previousError = 0
game:GetService("RunService").Heartbeat:Connect(function(dt)
local errorz = Goal.Y - part.Position.Y
integral = integral + errorz * dt
local derivative = (errorz - previousError) / dt
local out = kP * errorz + kI * integral + kD * derivative
vecterforce.Force = Vector3.new(0, out, 0)
previousError = errorz
end)
Also try this
atleast you got decent result
:D
magicians never tell how their tricks work
you can ask the ai 10x times
and he wont respond
you with that
even 200x times u can ask
ai dont know about
PID controller
or atlesat dont think it do
ye
PID :D
now looking at it
fr
u can just add velosity
Bruh just do a vector force with an upward force of part:GetMass()*workspace.gravity?