AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 16 Nov 2014 08:22 PM |
| I want to make a door that opens like it would like a regular door, from a hinge. But, I want to cframe it. How would I do something like this? (I'm not referring to sliding door, I'm talking about what a door does in real life when you open it) |
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
| |
|
|
| 16 Nov 2014 08:57 PM |
| CFrame.new(HingePosition) * CFrame.Angles(0, math.rad(HingeAnglesInDegrees),0) * CFrame.new(0, 0, -Door.Size.Z/2) |
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
| |
|
|
| 17 Nov 2014 05:51 AM |
Well I thought you wanted that...
The first part sets the CFrame at the hinge. The second rotates it, and the third moves the door outwards. |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2014 05:59 AM |
I found it more simplier Metaphorically of course
Assuming Door is classified
function tehdoor() for i = 1,90 do Door.CFrame = Door.CFrame *CFrame.Angles(0,0,.1) wait() end for i = 1,90 do Door.CFrame = Door.CFrame *CFrame.Angles(0,0,-.1)-- Just opposite wait() end
Door.Touched:connect(tehdoor)
|
|
|
| Report Abuse |
|
|
|
| 17 Nov 2014 06:02 AM |
| But that doesn't rotate it on it's hinge, unless it's hing is in the middle. |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2014 06:03 AM |
| Then add a Part next to it which enholds dem hinges e.e |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2014 06:09 AM |
| But then it would break off, if you mean the joint kind. |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Nov 2014 07:45 AM |
What you want is a "swing on axis" method. Here's code I wrote for Justin Kennett when he needed the same thing.
local increment = .05 -- best to keep it to a 5-base of 1(0)-base increment
function RunAnimation(p) local p = p or script.Parent local rightframe = p.CFrame + p.CFrame:vectorToWorldSpace( Vector3.new(1,0,0) * p.Size.X/2 ) for i = 0, math.pi/2, .05 do wait() local newframe = rightframe * (CFrame.Angles(0, -i, 0) * CFrame.new(p.Size.X/-2,0,0)) p.CFrame = newframe end end
RunAnimation()
It causes the door to open on its positive X axis end like a real door does. |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2014 07:49 AM |
| Does it automatically close? ;3 |
|
|
| Report Abuse |
|
|