Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would you get the face of a part and CFrame another part onto it?

Asked by 8 years ago

Say theres a 4x4x4 cube. If I clicked on the "top" face with my mouse then a part would spawn onto that face whose orientation is perpendicular to the surface. Is there any method to obtain that "face" and CFrame something onto it?

I tried mouse.TargetSurface, didn't work out really well.

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

You can get the CFrame of the middle of the surface by using Part.CFrame*CFrame.new(Part.Size*.5*mouse.TargetSurface)

Multiplying CFrames translates by the second relative to the first.

Ad

Answer this question