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

How to move a part along it's faces. I do **NOT** want it to move along it's front face?

Asked by 4 years ago
Edited 4 years ago

I understand that if you want to have a part move along its front face, you use lookVector, but what if I want to move it along its back face? How would I do so without changing the orientation? Is there such a possible feature? I search the entire web but found nothing.

0
-LookVector or LookVector*-1 ScriptGuider 5640 — 4y
0
How about side faces. :V lmao FadedJayden_Dev 118 — 4y
0
RightVector, -RightVector, UpVector, -UpVector theking48989987 2147 — 4y
0
Oh :v FadedJayden_Dev 118 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

I'm going to assume you want to change its CFrame to go in the direction you want. In that case, use multiplying CFrames. You just have to know the relative direction of the direction you want to go in. For example, for backwards, as you asked in your question, use the Positive Z direction. NOTE: CFRAME MULTIPLICATION IS NOT COMMUTATIVE. THIS MEANS: cf1 * cf2 ~= cf2 * cf1

--Make sure there is a reference to your part called "part"
local studsToMove = 10
part.CFrame = part.CFrame * CFrame.new(0, 0, 1 * studsToMove)
0
Hmmm, seems to work, I'll test it out and accept the answer if it's correct. Thanks! FadedJayden_Dev 118 — 4y
Ad

Answer this question