Zylez
|
  |
| Joined: 26 Mar 2016 |
| Total Posts: 417 |
|
|
| 12 Aug 2016 05:33 PM |
| I know how to do it in CFrame, but what about UDim? |
|
|
| Report Abuse |
|
|
Zylez
|
  |
| Joined: 26 Mar 2016 |
| Total Posts: 417 |
|
| |
|
Zylez
|
  |
| Joined: 26 Mar 2016 |
| Total Posts: 417 |
|
| |
|
Objectly
|
  |
| Joined: 18 Jul 2016 |
| Total Posts: 210 |
|
|
| 12 Aug 2016 05:44 PM |
| UDim2.new works with 2D positioning across a user's screen so it'd only go around a point on a 2d surface. You can do this with a loop that calculates the math of where the GUI should be via having a mathematically created circle. The object will follow along the circle's radius which will be calculated every loop. |
|
|
| Report Abuse |
|
|
Zylez
|
  |
| Joined: 26 Mar 2016 |
| Total Posts: 417 |
|
|
| 12 Aug 2016 05:49 PM |
| Yeah, I figured, but I would like to know the math behind it so that I can do this. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
Tuneable
|
  |
| Joined: 16 Feb 2013 |
| Total Posts: 2932 |
|
|
| 12 Aug 2016 05:54 PM |
2 ways to do this
1. Position a frame to the center point, and add the gui object into the frame. Change the gui object's y position to the radius. Set the frame rotation to the desired rotation.
2. Calculate the position
local function getPosition(position, rotation, radius) -- UDim2, degrees return UDim2.new(position.Offset.X + math.cos(math.rad(rotation)) * radius, position.Offset.Y + math.sin(math.rad(rotation)) * radius) end
|
|
|
| Report Abuse |
|
|
|
| 12 Aug 2016 05:54 PM |
local scale = 1/4 while wait() do for i = 0,360,12 do game.StarterGui.ScreenGui.Frame.Position = game.StarterGui.ScreenGui.center.Position + UDim2.new(math.cos(math.rad(i))*scale,0,math.sin(math.rad(i))*scale,0) wait() end end
Formerly xXTheRobotXx, add 13,349 posts |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 12 Aug 2016 05:59 PM |
local dot = script.Parent.Dot local spin = script.Parent.Spin
local angle = 0
while wait() do angle = angle + 0.1 spin.Position = UDim2.new(0,dot.AbsolutePosition.X-spin.AbsoluteSize.X/2+math.cos(angle)*60,0,dot.AbsolutePosition.Y-spin.AbsoluteSize.Y/2+math.sin(angle)*60) end
|
|
|
| Report Abuse |
|
|
Xsitsu
|
  |
| Joined: 28 Jul 2009 |
| Total Posts: 2921 |
|
|
| 12 Aug 2016 06:01 PM |
| You could make a single 1x1 pixel frame that contains the frame you want to spin around something. Position the frame inside of the 1x1 pixel frame to have its corner be in the 1x1 pixel. Then just spin the 1x1 pixel frame and it should work. |
|
|
| Report Abuse |
|
|