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

Does SetPrimaryPartCFrame take obstructions into account like MoveTo does?

Asked by 8 years ago

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!

0
this is such a good question koolkid8099 705 — 8y
0
Now, I wouldn't think due to it being CFrame... But I may be wrong. M39a9am3R 3210 — 8y
0
But technically its only changing the CFrame of 1 part. So im not sure koolkid8099 705 — 8y

1 answer

Log in to vote
0
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
8 years ago

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.

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. Spongocardo 1991 — 8y
0
Doesn't matter, I used a combination of MoveTo and SetPrimaryPartCFrame to get both effects. Spongocardo 1991 — 8y
Ad

Answer this question