AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 31 Jan 2017 06:53 PM |
for i = 1, 30 do Arg1.Frame.CFrame = Arg1.Frame.CFrame * CFrame.new(0, 0, Arg1.Frame.Size.X/40) * CFrame.Angles(0, math.rad(3), 0) wait() end -- Arg1 is model, Frame is inside model. It is the door
This is inprecise. How can I make it work perfectly? |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 31 Jan 2017 06:55 PM |
Use a hinge and bodymover, best solution I've found.
|
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 31 Jan 2017 06:57 PM |
I saw that in apoc, how exactly does that work?
Instead it seems smarter to do local startcframe = Door.Frame.CFrame
-- cframe stuff around start |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 31 Jan 2017 07:00 PM |
I made a door that resets itself every 10 minutes or so in case it breaks (although it rarely does), used by bodymovers. 1 position closed position, it will naturally rotate, 1 position toward a location where it would make the door swing open
|
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 07:00 PM |
Not sure what a hinge is tbh BUT cant you just do.
for i=1,360 do a.CFrame=CFrame.new(a.CFrame.p.unit,math.rad(i)) end
|
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 31 Jan 2017 07:04 PM |
| 2nd constructor is a vector3 pos not a # |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 07:11 PM |
I was thinking of something like this: The part I tested it on spun but it acted in a weird manner.
This is what I was thinking of if anyone wanted to know what I was tlaking about.
local p=workspace.Part for i=0,1,1/(36/3) do p.CFrame=p.CFrame*CFrame.fromAxisAngle(p.CFrame.p.unit,math.rad(i)) wait() end
Try what the others suggested :( or this.
try this maybe.
for i=0,1,1/(36/3) do p.CFrame=p.CFrame*CFrame.Angles(0,math.rad(i),0) end
|
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 31 Jan 2017 07:18 PM |
With p.CFrame=p.CFrame*CFrame.Angles(0,math.rad(i),0) it just rotates in place. Im testing out how to counter measure and make it appear to rotate around a hinge, but I cant find a way to do it. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 07:20 PM |
Ohhh.
Hmm maybe using cos and sin with a fake circles radius of the doors width/2
Ill try to think of code like that.
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 31 Jan 2017 07:27 PM |
rotate a block centered on hinge, have door welded to that block
|
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 31 Jan 2017 07:30 PM |
| seems like a lot of overhead |
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
| |
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
| |
|
|
| 01 Feb 2017 04:52 PM |
I have the hinge code but it makes it where the actual starting position is changed but I have no idea how to offset it according to how it is facing.
goo.gl/xBgzeG
|
|
|
| Report Abuse |
|
|
|
| 01 Feb 2017 05:02 PM |
| you may have to change the X to Z and the rightVector to leftVector OR lookVector mine is set up to use the standard block which has the longest side..x. According to this I made it so X can be any length and rotate upon it. This will work with any integer goo.gl/1oMe9S local function rotatePart(part,deg) local step=1 if deg<0 then step=-step end local s=math.floor(part.Size.X/2) local org=part.CFrame-part.CFrame.rightVector*(s+0.5) for i=0,deg,step do local i=math.rad(i) local x,y=math.cos(i),math.sin(i) part.CFrame= org *CFrame.Angles(0,math.atan2(y,x),0) ######################## wait() end end rotatePart(workspace.Part,-90) --usage |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2017 05:04 PM |
goo.gl/1oMe9S :)))) vid goo.gl/RBLsnB :)) code
|
|
|
| Report Abuse |
|
|
|
| 01 Feb 2017 05:07 PM |
| have the door & hinge in a model, set the hinge as the primarypart, and set the primary part's cframe to your liking, if you really want to do it via CFrame that is |
|
|
| Report Abuse |
|
|
Thane_1
|
  |
| Joined: 08 Apr 2009 |
| Total Posts: 827 |
|
|
| 01 Feb 2017 05:33 PM |
You'd have better luck using a Motor, but this is the CFrame version: The hinge should be level with the door, and X of DoorOffset is half the Width of the door (would be 5 in this case)
local Pos = CFrame.new(0,0,0) --Position of hinge local Angle = 0 local DoorOffset = Vector3.new(2.5,0,0)
Door.CFrame = Pos * CFrame.Angles(0,math.rad(Angle),0) * DoorOffset
~Who's awesome? You're awesome! |
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 04 Feb 2017 11:35 AM |
| Finally got it to work, just by using a script. Will save hundreds of parts |
|
|
| Report Abuse |
|
|