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

How to keep a Single Direction using CFrame?

Asked by 10 years ago

How would I go about moving a part in a Single Direction using a CFrame to the right, while that part is being rotated on the x Axis?

for i = 1,10 do
part.CFrame = part.CFrame * CFrame.new(0.1,0,0)
part.CFrame = part.CFrame * CFrame.Angles(0.1,0,0)
end

As the following code would change the direction of it's movement, due to the angle change

0
Not tested, but try adding a Vector3. 'part.CFrame = part.CFrame + Vector3.new(0.1, 0, 0) Perci1 4988 — 10y

2 answers

Log in to vote
0
Answered by
SirGory 15
10 years ago

I found this worked in any direction

for i = 1,10 do
part.CFrame=(part.CFrame+Vector3.new(0.1,0,0))*CFrame.Angles(0.1,0,0)
wait()
end
0
But I need to add a CFrame to it, not a Vector3, so I can CFrame it to it's right side, then have it continue that direction while rotating LunaScripter 80 — 10y
Ad
Log in to vote
0
Answered by
hiccup111 231 Moderation Voter
10 years ago

You can add multiple cframe conditions, as SirGory demonstrated above:

part.CFrame = part.CFrame * CFrame.new(0.1,0,0) * CFrame.Angles(0.1,0,0)

Answer this question