Redyz
|
  |
| Joined: 27 Dec 2007 |
| Total Posts: 660 |
|
|
| 15 Oct 2011 03:08 PM |
Hello,
I have a question; I possess a script that changes the time automatically using a set algorithm, thus there is a day and night cycle.
I would like to have the ambient lighting to somewhat follow the normal "real life" shadow process.
What would be the nicest way to set that accordingly?
I believe the "Ambient" property is a Color3 value, my question is simply; how do I set this nicely according to TimeOfDay which is a completely different object?
Thank you, -Redyz |
|
|
| Report Abuse |
|
|
Lowcart
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 1323 |
|
| |
|
Redyz
|
  |
| Joined: 27 Dec 2007 |
| Total Posts: 660 |
|
|
| 15 Oct 2011 03:23 PM |
| Thank you I suppose, but it doesn't really solve my problem.. |
|
|
| Report Abuse |
|
|
Flurite
|
  |
| Joined: 03 Apr 2011 |
| Total Posts: 5386 |
|
|
| 15 Oct 2011 03:34 PM |
When I use Color3 values, I use the BrickColor data type. This data type has a property called 'Color' which converts the BrickColor into a Color3 value.
Ex:
gui = script.Parent gui.BackgroundColor3 = BrickColor.new('Bright blue').Color
~Flurite, ROBLOX Wiki Writer |
|
|
| Report Abuse |
|
|
Fl0x
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 5169 |
|
|
| 15 Oct 2011 03:47 PM |
| BrickColor are for people who can't use hexadecimal. |
|
|
| Report Abuse |
|
|
Redyz
|
  |
| Joined: 27 Dec 2007 |
| Total Posts: 660 |
|
|
| 15 Oct 2011 04:06 PM |
Yeah well, I'd use brickcolor as a last resort;
I can deal with hex I guess but that doesn't solve my algorithm problem. |
|
|
| Report Abuse |
|
|
Fl0x
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 5169 |
|
|
| 15 Oct 2011 04:19 PM |
s=math.floor(tick()%60) m=math.floor(tick()/60%60) h=math.floor(tick()/3600 % 24) game.Lighting.TimeOfDay=h..":"..m..":"..s while true do rawambient=math.floor(tonumber(string.sub(game.Lighting.TimeOfDay,1,2)/0.094117)) print(rawambient) ambient=0 if rawambient > 128 then ambient = -rawambient else ambient=rawambient end print(ambient) game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight()+2) game.Lighting.Ambient=Color3.new(-ambient,-ambient,-ambient) wait() end
Does the trick for me. |
|
|
| Report Abuse |
|
|
Redyz
|
  |
| Joined: 27 Dec 2007 |
| Total Posts: 660 |
|
|
| 16 Oct 2011 01:52 PM |
@Fl0x
That's a start, it's not very smooth but I can definitely try to work it out.
Thank you. |
|
|
| Report Abuse |
|
|
Redyz
|
  |
| Joined: 27 Dec 2007 |
| Total Posts: 660 |
|
|
| 16 Oct 2011 02:53 PM |
I tried making my own but roblox seems to ignore most of my lighting settings, when I set it at (0,0,0) it only applies it (ingame that is, the property appears set) every now and then.
It acts funky and I'm wondering if the ambient parameter has restrictions about how many times you can set it during X time or something along those lines.. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 16 Oct 2011 03:16 PM |
| Changing the ambient is like changing the sky color from blue to green - it just isn't natural. You should use Brightness to adjust darkness and daylight settings rather than color-coat the world. |
|
|
| Report Abuse |
|
|