Hey There!
I’m trying to move one model to another model so that the CFrame of the first Model’s attachment matches the CFrame of the second model’s attachment.

(Here I’m moving the red Model with respect to the blue model’s attachment)

Before:

After:

Video To Explain:
https://gyazo.com/70ed29211f7b28c71d845cacd8ea1a0f

I know how to do this with Position and Orientation values with BaseParts, however I’m not sure how to make this happen for models with CFrame.

Thanks for Trying!

2 Likes

PapaBreadd
(PapaBreadd)
October 6, 2021, 12:11pm
#2
This is very similar to how welds work

Basically, you want a cframe so that:

cframe1 * offset1 = cframe2 * offset2

Where offset is the local cframe of the attachment

To solve for cframe2, just multiply it by the inverse of offset2 like this:

cframe2 = cframe1 * offset1 * offset2:Inverse()

You should be able to just do setprimarypartcframe or some other similar function to set cframe2

2 Likes

let me work it out and get back to you! Thanks for replying btw

1 Like

Works like a charm! I owe you one dude!