generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Rotate A Part From A A Hinge From Script

Previous Thread :: Next Thread 
ShadowNinjaCrafter is not online. ShadowNinjaCrafter
Joined: 08 Mar 2015
Total Posts: 163
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
Kofphtastrophe is not online. Kofphtastrophe
Joined: 28 Oct 2015
Total Posts: 154
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
Kofphtastrophe is not online. Kofphtastrophe
Joined: 28 Oct 2015
Total Posts: 154
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
ShadowNinjaCrafter is not online. ShadowNinjaCrafter
Joined: 08 Mar 2015
Total Posts: 163
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image