reposted from yesterday since I couldn’t get a definitive answer past a dead end.
Alright so basically I’m trying to make these cool missiles for a boss fight I’m making, a homing one and a not homing one, with functions as you’d expect.
should be simple except that said missiles have to be moved with CFrame
due to how they were constructed ( direct position changes will stop welded parts from being moved with it ), it has a central MovementPoint
part which is moved using CFrame
in order to move the missiles
using CFrame
for this comes with a problem though, rotating the missiles towards a target point can’t be done within a Tween
, at least not very easily.
when a CFrame
tween is used on the missiles, it will make them rotate vertically during it, ending with vertical missiles instead of them facing the target. I have since corrected this and instead now they can end up in all sorts of directions based on the method used which is still very much not what I want
I’ve tried all sorts of methods to get the tweens to work along with the lookAt
from manual CFrame
position changes through While loops, CFrame.lookAt()
, CFrame.Angles()
, Orientation
changes and so on. basically everything I could think of, yet none of it worked.
I feel providing most of the script and what it does might be handy, therefore I will. keep in mind no errors show up
script.Parent.Event.Event:Connect(function(Target)
local Thing1 = (script.Parent.MovementPoint.Position - Target).Magnitude
local Thing2 = (Thing1 / 0.5) / 100
local TweenInf = TweenInfo.new(Thing2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local Finish = {CFrame = CFrame.new(Target)}
local Tween = TweenS:Create(script.Parent.MovementPoint, TweenInf, Finish)
Tween:Play()
wait(Thing2)
end)
there’s a little bit more to it but it’s irrelevant here
Target
is the target position, it isn’t an object or instance, it is a Vector3 value.
Thing1
and Thing2
are pretty self-explanatory, they just judge the distance from the start to the target to make the missile speed consistent.
the rest is pretty obvious.
I’m at a complete loss for what to do and I’m very stuck right now. any decent advice that doesn’t require me to completely redesign the missiles or do some drastic over-the-top math calculation would be much appreciated.
Update: I have fixed the rotation of the Homing missiles by rotating their MovementPoint in a specific way, however Non-homing missiles are still not quite working
this edit was fairly different from the original version because it didn’t really make sense anymore past a certain point