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
 

Re: Sun Direction

Previous Thread :: Next Thread 
RubiksCubix is not online. RubiksCubix
Joined: 04 Dec 2009
Total Posts: 4243
11 Aug 2012 05:57 PM
How do I make a script that can tell if the player's camera is pointing at the sun, or in a particular direction?
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
11 Aug 2012 06:01 PM
Use the dot product of the sun direction and camera.CoordinateFrame.lookVector
Report Abuse
Candymaniac is not online. Candymaniac
Joined: 08 Oct 2009
Total Posts: 8985
11 Aug 2012 06:04 PM
@su8;
What do you mean?

☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance.
Report Abuse
RubiksCubix is not online. RubiksCubix
Joined: 04 Dec 2009
Total Posts: 4243
11 Aug 2012 06:07 PM
Basicly (I know its a long shot :D), I was inspired by the New Crysis 3 engine to create lense flare, and I'm trying to make a function that checks to see if your camera angle is within a certain range from the angle of the sun, so I can make a gui lense flare.
Report Abuse
CoastSniper is not online. CoastSniper
Joined: 07 Mar 2012
Total Posts: 60
11 Aug 2012 09:05 PM
sun is party of the skybox boi
so check into that
you will have to find a location and * falls asleep in bore *.
Report Abuse
L3GabeL4 is not online. L3GabeL4
Joined: 18 Feb 2012
Total Posts: 808
11 Aug 2012 09:06 PM
The sun is located at 0x and 0.1y.
Report Abuse
oxcool1 is not online. oxcool1
Joined: 05 Nov 2009
Total Posts: 15444
11 Aug 2012 09:28 PM
[ Content Deleted ]
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
11 Aug 2012 10:00 PM
local isLookingAtSun = (workspace.Camera.CoordinateFrame.lookVector - game.Lighting:GetSunDirection()).magnitude < 0.5 then

print(isLookingAtSun) --> true if true, false if false
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
11 Aug 2012 10:05 PM
Also...

1 = Full view (of screen)
0.5 = Half view
0.25 = Quarter view

So, when playing with your radius, use a scale of 0 - 1. Meant to suggest this in my last post.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
11 Aug 2012 10:09 PM
Thought this was Scripting Helpers. Should post in that forum next time you have a rbx.lua code related question.
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
12 Aug 2012 05:23 AM
i think its something liek

trigonometricThingie=camera.CoordinateFrame.lookVector:Dot(sundirection)

if trigonometricThingie>0 then
print("IT BURRRNNNSNSSSS")
end


im not sure if camera.CoordinateFrame has the camera direction (you might need to calculate it from the coordinateframe and focus or something if coordframe only has the position...)

and idk how to get sun direction but i assume its some method of lighting
Report Abuse
RA2lover is not online. RA2lover
Joined: 09 Nov 2008
Total Posts: 1254
12 Aug 2012 07:16 AM
it's a method of lightning.
Report Abuse
Candymaniac is not online. Candymaniac
Joined: 08 Oct 2009
Total Posts: 8985
12 Aug 2012 12:02 PM
Ok I made a quick lens-flare effect for all of you if you want to use. It's open-sourced and can be found in my models. I used nate's method with a few of my own to avoid the lens flare effect from working at night time.

☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance.
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
12 Aug 2012 12:09 PM
I've seen a real lens flare effect before on ROBLOX.

You have to project positions onto the screen from the 'World' view or whatnot.
Report Abuse
Candymaniac is not online. Candymaniac
Joined: 08 Oct 2009
Total Posts: 8985
12 Aug 2012 12:11 PM
@Quenty;
I think oysi made one with that method.

☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
12 Aug 2012 03:59 PM
[ Content Deleted ]
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
12 Aug 2012 04:20 PM
Ayy, don't judge. I don't care what code the OP uses. There are multiple ways of doing this and I just did it one of the ways.

Big whoop.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
12 Aug 2012 04:35 PM
[ Content Deleted ]
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
12 Aug 2012 04:38 PM
I didn't take it offensively :o?
Report Abuse
Candymaniac is not online. Candymaniac
Joined: 08 Oct 2009
Total Posts: 8985
12 Aug 2012 04:40 PM
@Oysi;
If I did it your way then I'll be able to have that multiple flares effect?

☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance.
Report Abuse
RubiksCubix is not online. RubiksCubix
Joined: 04 Dec 2009
Total Posts: 4243
12 Aug 2012 05:00 PM
Oysi, your function works, except it makes the glare happen looking the excat opposite direction of the sun. How can I fix this?
Report Abuse
Tom11255 is not online. Tom11255
Joined: 09 Nov 2010
Total Posts: 365
12 Aug 2012 05:01 PM
Im thinking you mean SKYBOX.
Report Abuse
RubiksCubix is not online. RubiksCubix
Joined: 04 Dec 2009
Total Posts: 4243
12 Aug 2012 05:03 PM
Never mind, it works great, I messed up the inequality. I will publish for free use when complete.
Report Abuse
RubiksCubix is not online. RubiksCubix
Joined: 04 Dec 2009
Total Posts: 4243
12 Aug 2012 05:16 PM
Finished it. I will post a link when its done moderating! Thanks again!
Report Abuse
Candymaniac is not online. Candymaniac
Joined: 08 Oct 2009
Total Posts: 8985
12 Aug 2012 05:25 PM
Rubiks, you might want to make it so that the intensity is defined by the ratio at how close the camera is to the sun, so you can make the intensity much more smooth, not by pre-defined variables.

☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance.
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