How to CFrame surface to surface?

So Imagine I have a house,
image
The Primary CFrame of the the group is the bottom base of the house.

Now Imagine I got a flat terrarin,
image

What I want is to attach the bottom of the house with the top surface of the terrarin. How am i suppose to do this?

You could probably just raycast down, get the hit normal, and then set the CFrame of the house based on the normal and hit position.

1 Like

Guess I have to learn normal’s and hit positions…

Well the normal is essentially the direction a raycast hit is facing.

Let’s say you raycast down on a part.


That green ball can represent the hit position.
The normal basically just means the orientation of the hit surface. In this case, it would point out from the hit angled a bit because the part is rotated.

(yes I built an arrow out of attachments; I’m too lazy to draw on it)

1 Like

That’s pretty cool, I will surely try fiddleing with it…

1 Like