|
| 09 May 2017 05:11 PM |
| So say I wanted to script a door that opens by pressing a button, but it rotates on a hinge. Is there a way to make it turn as if it were connected to a wall rather then it just spinning? |
|
|
| Report Abuse |
|
|
|
| 09 May 2017 05:15 PM |
You could use CFrame.
Ie; for i = 1, 10 do DoorToGetOutOfThisThread.CFrame = DoorToGetOutOfThisThread.CFrame *CFrame.Angles(i, 0, 0) wait() end
And for both smoother animation and transitions you **should** use lerp. |
|
|
| Report Abuse |
|
|
|
| 09 May 2017 05:22 PM |
In case you don't know about CFrame, then i should clarify, as the code i provided earlier will look terrible.
Try something like this:
MyDoo = script:WaitForChild("A_Red_Door_To_Get_Out_Of_This_Thread") for i = 1, 45 do MyDoo.CFrame = MyDoo.CFrame *CFrame.Angles(math.rad(i),0,0) *CFrame.new((0.1*i), 0, (0.1*i)) wait() end MyDoo.Parents = "died in a car crash" |
|
|
| Report Abuse |
|
|
|
| 09 May 2017 05:25 PM |
| Ok, but what if you wanted to rotate as if the door were connected to a hinge? Like how would I add an offset for the door to be rotated, or like changing the axis in which it is rotated? |
|
|
| Report Abuse |
|
|