How would i place Part A on a face of Part B with CFrame math

image


what i want to accomplish ^^^

1 Like

Rigid Constraints/Welds, both can use attachments to help align the positions and orientation

Rigid constraint method:

Weld method:

local weld = Instance.new("Weld")

weld.C0 = attachment0.CFrame

weld.Part0 = attachment0.Parent

weld.C1 = attachment1.CFrame

weld.Part1 = attachment1.Parent

weld.Parent = attachment1.Parent --any parent under workspace to make the weld active

Manual method:

Part1.CFrame = Part0.CFrame*Part0.Attachment.CFrame*Part1.Attachment.CFrame:Inverse()

This is not exactly what i was hoping for, I can provide a better example if you want of what i will use this for

https://i.gyazo.com/5815a9ce2a65c827c348393c1da7e78c.mp4

Oh alright, next time please put your use case in your post as well. This problem is alignment, where you want a part to align to a surface.

1 Like

I have tried using lookAt in the past and it does really weird stuff, dont know if i just dont know how to properly use it. ive looked at many things about it and it is still typically very buggy
image
this is what it returns in attempts to print the set lookAt Cframe