Alright so basically I’m trying to make these cool missiles for a boss fight I’m making, they are supposed to face a target position and move towards it.
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
which is what is actually moved and everything else uses WeldConstraints
to stay welded onto it.
using CFrame
for this comes with a problem though, rotating the missiles towards the 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.
what I want to achieve instead is the missiles to look at the target and not look away from it, the problem is however is using CFrame.new()
and CFrame.lookAt()
in one or individual tweens sends them 10s of millions of studs away from 0,0,0
.
the construct I’ve tried using looks a bit like this
local TweenInf = TweenInfo.new(Thing2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local Finish = {CFrame = CFrame.new(Target) * CFrame.lookAt(script.Parent.MovementPoint.Position, Target)}
local Tween = TweenS:Create(script.Parent.MovementPoint, TweenInf, Finish)
the variables:
Thing2
is just a timing variable to move the missiles at the same speed every time they are fired based on distance
Target
is the Target position that the missile moves to and is a Vector3
value
the rest is declared and shown in that code block
assistance here would be greatly appreciated