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 » Scripting Helpers
Home Search
 

Re: Camera to Sun Position

Previous Thread :: Next Thread 
RubiksCubix is not online. RubiksCubix
Joined: 04 Dec 2009
Total Posts: 4243
04 Nov 2012 05:47 PM
Please help me complete my gui. I need a way to get four seperate number values:
1.) How far right the player's camera view is from the sun
2.) How far left the player's camera view is from the sun
3.) How much higher the player's camera view is from the sun
4.) How much lower the player's camera view is from the sun

This, hypothetically could be simplified into two number values:
1.) How far right and/or left the player's camera view is from the sun
2.) How much higher and/or lower the player's camera view is from the sun

I need this to make a final awesome addition to a lense flare gui I developed with people on this forum a while ago! Please do help!
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
04 Nov 2012 06:33 PM
We are scripting helpers, not scripting writers. At least attempt to make the code, and we will fix it even if it has hundreds of errors. We won't write code for you though.
Report Abuse
RubiksCubix is not online. RubiksCubix
Joined: 04 Dec 2009
Total Posts: 4243
04 Nov 2012 09:16 PM
Ok! I will try to write it!
Report Abuse
crazyman32 is online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
04 Nov 2012 09:55 PM
Talk to Anaminus. He's a genius when it comes to this stuff :P

In fact, I believe he has a plugin that lets you click in the sky and it will move the sun to that position.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
04 Nov 2012 11:08 PM
O_o MOVE THE SUN?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
04 Nov 2012 11:10 PM
o wiat it's not that hard,

geogprahial longitufeg or whateveretufcg
Report Abuse
pashmi is not online. pashmi
Joined: 27 Jan 2010
Total Posts: 7120
05 Nov 2012 01:16 AM
actually probably he wrote a formula which takes the skybox's position into account, and moves the sun by a degree + that formula
Report Abuse
Aerideyn is not online. Aerideyn
Joined: 16 Jan 2010
Total Posts: 1882
05 Nov 2012 04:28 AM
cam = workspace.CurrentCamera

sunDirection = game.Lighting:GetSunDirection()
camDirection = cam.CoordinateFrame.lookVector

sunDirectionXZPlane = Vector3.new(sunDirection.X,0,sunDirection.Z).unit

camDirectionXZPlane = Vector3.new(camDirection.X,0,camDirection.Z).unit
camDirectionYPlane = Vector3.new(sunDirection.X,camDirection.Y,sunDirection.Z).unit

angleLeftRight = math.acos(camDirectionXZPlane:Dot(sunDirectionXZPlane))
angleUpDown = math.acos(camDirectionYPlane:Dot(sunDirection))


--If you want the total angle it's much simpler...

angle = math.acos(camDirection:Dot(sunDirection))
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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