I tried using Motor6Ds to make an animation for it but when i use the animation editor, it looks really weird. All i want it to do is rotate 45 degrees. What is the best way for me to do this? Edit: and i don't just want it to teleport to the position, I want it to move towards it.
Using CFrame, you can rotate an object...
1 | local Part = workspace:WaitForChild( "Part" ) -- to account for latency |
2 | local Rad = math.rad |
3 |
4 | local function RotatePart(Object) |
5 | Object.CFrame = Object.CFrame*CFrame.Angles(Rad( 5 ),Rad( 5 ),Rad( 5 )) |
6 | end |
7 |
8 | RotatePart(Part) |
You can convert degrees to radians cleanly using 'math.rad()' ... or:
1 | local radians = degrees * math.pi / 180 |
(:Lerp())
1 | for i = 0 , 1 , . 1 do |
2 | Object.CFrame = Object.CFrame:lerp(Object.CFrame * CFrame.Angles( 0 , 0 ,Rad( 45 )), i) |
3 | end |
I figured out myself that if I put little "hinges" on the corner of the door I can make the door be animated to move around the corner in a more realistic way.