I want to add another Part (D) so that it is in the same position as B is relative to A.
(Regardless of orientation, etc).
EDIT: I know I can work out the vector3 distance and apply, but if the part changes orientation it wont work. Also, if the part is facing between two directions it wont work.
If im understanding what you want correctly then it should just be a positional offset, which should work regardless of rotation.
local PartA: BasePart = (...)
local PartB: BasePart = (...)
local PartD: BasePart = (...)
-- similiar to raycasts, (finalpos - initalpos) = position relative to initalpos
local RelativePosition = PartB.Position - PartA.Position
--then we can just add back part A's position (or any other part that you want the relative position to be on) and apply the relative position on top of it.
PartD.Position = PartA.Position + RelativePosition
For context, this is going to be used for a camera and character - so they need to be facing / rotated exactly as parta and b are. If PartA is rotated so it’s behind itself PartB should be projected in that direction too.