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

How to keep rotation in a CFrame?

Asked by
RubenKan 3615 Moderation Voter Administrator Community Moderator
10 years ago

When i use a CFrame, it always comes back into a certain rotation, even if i use:

script.Parent.CFrame = CFrame.new(script.Parent.Position) * CFrame.Angles(script.Parent.Rotation)

Can anyone help me / tell me why this does not work?

3 answers

Log in to vote
1
Answered by 10 years ago
local vect = Vector3.new(0,0,0)
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(vect)
Ad
Log in to vote
0
Answered by
modFrost 130
10 years ago

Below will spin the part around in circles,

script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(2),0)
Log in to vote
0
Answered by 5 years ago

You don't use

script.Parent.CFrame = script.Parent.CFrame.new(part.Position) * CFrame.new() 

You use

script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(script.Parent.Orientation)

If you want it to rotate, you would use

while true do
    script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,math.rad(1),0)
end

And that should do it.

Answer this question