So basically im making a homing missile using body velocity and bodygyro it works fine for the most part but for some reason I cant track the target head-on or side profile it always track the back of the missile
You can see it works well from rear aspect
but from side or front aspect it just turn right around the back of the target
--This is most of the code moving the missile
local distance = (missile.Position - target.Position).Magnitude
-- local LV = missile.CFrame.LookVector
-- local XZDist = math.sqrt(LV.x ^ 2 + LV.z ^ 2)
-- local Pitch = math.atan(LV.y / XZDist)
if missileactive == false then return end
if Gas <= MaxGas then
speed = speed - .5
if speed == 0 then
end end
if Gas >= MinGas then
speed = speed + 1
Gas = Gas - 1 end
if Gas <= MinGas then
missile.Parent.Emmiter.Smoke1.Enabled = false
missile.Parent.Emmiter.Smoke2.Enabled = false
end
local acceleration = missile.CFrame.LookVector * speed
local gravity = missile.CFrame.UpVector
bv.Velocity = acceleration
bg.CFrame = CFrame.new(missile.Position, target.Position)