How to Tween a CFrame to Move to a Position While also Looking at that Position?

Hi,

I am trying to tween a CFrame such that,

An Object A is tweened from an initial CFrame to the CFrame of object B while also maintaining an orientation facing towards object B. This would mean the Position and LookVector properties of the CFrame are the same vector, which causes issues. I am stumped as to how I can accomplish this without having the Position and LookVector be the same value.

Doing this:

A.CFrame = CFrame.lookAt(BPosition, BPosition)

Creates a CFrame where the position and LookVector are both the same vector. The idea behind this is that the object’s position is tweened to BPosition while maintaining an oritentation that Looks At BPosition, pointing to it as the object moves.

However, I know creating a CFrame with the same Position and LookVector properties is incorrect but I am completely stumped as to how to do this using CFrames. Since I am tweening a model with WeldConstraints I must use CFrames to move the object’s position rather than tweening the Position and Orientation itself.

Any help would be greatly, greatly appreciated. I’ve been stuck on this for a while now.

1 Like

Prior to tweening could you try calling A:SetPrimaryPartCFrame(CFrame.new(A.PrimaryPart.CFrame.Position, BPosition))?
*Edit: I may have misunderstood, was the issue that it rotates to object B’s orientation as it moves? You could save A’s CFrame.Angles before tween and create a new CFrame destination based on BPosition * those angles.