Positioning Models With Same Offset

I know there are a few topics related to this, but I am still pretty confused. Basically, I have 3 models. Let’s call them a, b, and c. I would like to get the difference in CFrame (rotation AND position, not just position), between a and b, then position b with that difference relative to c. Example, if b was 2 STUDS forward from a, I would like to position b 2 STUDS forward from c. I’m sorry if this was a TERRIBLE explanation I have no idea how to explain this.

I believe you can use ObjectSpace and WorldSpace for this:

local offset = CF_A:ToObjectSpace(CF_B)
B:PivotTo(CF_C:ToWorldSpace(offset))

Let me know if that works out for you :smiley:

1 Like

Okay that worked basically perfectly, thanks, one more thing though how could I make it the exact same as before but move B 2 studs forward in the same direction (still move b to CF_C:ToWorldSpace(offset) but also 2 studs forward relative to that CFrame) sorry if that made no sense, thanks for the repsonse!!

So do the same but B gets offset by 2 studs extra?

local offset = CF_A:ToObjectSpace(CF_B)
B:PivotTo(CF_C:ToWorldSpace(offset + Vector3.new(0,0,2)))

Maybe something like that? :smiley: It might be -2 and not +2

1 Like

Will try now. Thanks for all your help!

1 Like

Thanks, it worked perfectly! Made a few modifications in my code but yeah it worked!

1 Like