PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

CFrame

BasePart

CFrame

The CFrame property determines both the position and orientation of a part relative to the world. The part is rendered such that the CFrame is the center of the rendered 3D model (with one exception outlined below). For keeping track of positions relative to a part’s CFrame, an /Attachment is useful. Most visual flair objects (such as particles and lights) will render at a part’s CFrame.

When setting CFrame, other joined parts are also moved relative to the part whose CFrame was set. This could be used for teleporting a player’s character, however it is recommended to use /Model/SetPrimaryPartCFrame instead if you want to move an entire model. Unlike /BasePart/Position, setting CFrame will always move the part to the exact given CFrame; in other words: no overlap checking is done when setting CFrame. If two collidable parts happen to overlap and one is not /BasePart/Anchored, the physics solver will attempt to resolve the overlap.

In online sessions, a part may be rendered differently than its CFrame may suggest (e.g., for tweening the different CFrames received from the server). Use /BasePart/GetRenderCFrame to get the apparent CFrame.


Code Samples


Setting Part CFrame

This code sample demonstrates setting a part’s CFrame in many different ways. It showcases how to create and compose CFrame values. It references a sibling part called “OtherPart” for demonstrating relative positioning.