How would I go about placing a thin layer of snow on top of an parts top face, I would just make the script clone the part at change the add to the Z value of the CFrame, but the parts are cframed and different sizes.
CFrames describe a position and orientation in space.
Actually, they describe the position and orientation relative to some reference frame.
If you have some reference
CFrame and some part
, then you can say
relative = reference:toObjectSpace( part.CFrame )
to get a relative
CFrame which describes the offset from reference
to part.CFrame
.
To 'apply' this relative
change, you can use
absolute = reference:toWorldSpace(relative) -- or = reference * relative -- (same thing)
For a Part, the origin (0, 0, 0) is the Part's CFrame. The Top surface is at CFrame.new(0, part.Size.y/2, 0)
.
Thus we can get a CFrame with the same orientation as Part, but at its Top surface, using
top = part.CFrame * CFrame.new(0, part.Size.y/2, 0)
If you want to put a part on top of it that's 0.2 studs thick, then that part's center would have to be 0.1 studs further out:
snow.Size = part.Size * Vector3.new(1, 0, 1) snow.CFrame = part.CFrame * CFrame.new(0, part.Size.y/2 + 0.1, 0)