Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Does SetPrimaryPartCFrame take obstructions into account like MoveTo does?

Forgive me for the basic question as I've never dealt with moving models in this fashion before.

So, I'm working on a teleport system and I wanted to use CFrame instead of Vector3 to move the players and made it so my teleports use SetPrimaryPartCFrame instead of MoveTo.

Now I know MoveTo reacts to obstructions such as Terrain, other players, etc when moving models and changes the Y axis of the Vector3 accordingly, but I was wondering if SetPrimaryPartCFrame does the same thing, but with CFrames.

ROBLOX Wiki makes no mention of this functionality on the SetPrimaryPartCFrame page but it does say that you should use SetPrimaryPartCFrame when dealing with rotations on the MoveTo method page of a model, so I'd assume it does take obstructions into account.

Any help is appreciated, thanks!

3 comments

0

this is such a good question

0

Now, I wouldn't think due to it being CFrame... But I may be wrong.

0

But technically its only changing the CFrame of 1 part. So im not sure

1 answer

✓ Accepted answer

The method SetPrimaryPartCFrame does not take obstructions into account.

What it does is directly sets the CFrame of the PrimaryPart and then moves the rest of the parts in the model so that they are in the same location relative to the PrimaryPart, not taking into account anything that may be in the way of the model.

2 comments

0

Thank you. Do you know if there is any way for me to make it take obstructions into account? I know that I can change the CFrame so that the Y axis is higher, but I don't know how to accurately take obstructions into account like ROBLOX does with MoveTo so that I know how much to move it up by.

0

Doesn't matter, I used a combination of MoveTo and SetPrimaryPartCFrame to get both effects.

This discussion is preserved as it was. New answers, comments, and votes are closed.