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
 

how to make a GUI point at a 2d position?

Previous Thread :: Next Thread 
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
08 Jan 2017 07:03 PM
How would I make the rotation, set just right to point the GUI at a 2D set position?
Report Abuse
C_Sharper is online. C_Sharper
Joined: 03 Oct 2011
Total Posts: 6405
08 Jan 2017 07:11 PM
I remember being told how this works. I never took trig, so I don't know too much about angles. local angle = ############# # ##### GUI.Rotation = angle Probably way off the money.
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
08 Jan 2017 07:13 PM
something about
math.atan2


#code self = nil
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Jan 2017 07:31 PM
Something like this should work assuming AnchorPoint = (0, 0)

local obj1Center = obj1.AbsolutePosition + obj1.AbsoluteSize/2
local obj2Center = obj2.AbsolutePosition + obj2.AbsoluteSize/2
local off = obj2Center - obj1Center
local angle = math.atan2(off.Y, off.X)
obj1.Rotation = math.deg(angle)
Report Abuse
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
08 Jan 2017 08:22 PM
@cntkillme

Thanks, it works perfectly!
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