Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by kaelan · Jan 16, 2011 at 03:01 AM · lightinglightpoint

How do i make night and day transitions

what script do i put on a point light to make it so day last 15 minutes and it slowly transitions into night and night last 1o minutes and slowly transitions into day?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by Jessy · Jan 16, 2011 at 03:38 AM

Unity is not a "collection of scripts you attach". There are a few that come with it to do very common things, and that demonstrate how to script, but in general, you need to program things yourself. You can always search the Unify wiki for helpful scripts, but what you're talking about is not so general-purpose that I'd expect it to be there.

Here are the pages that I believe will be most helpful to you in learning what you need to learn to achieve your effect:

http://unity3d.com/support/documentation/ScriptReference/Light-intensity.html

http://unity3d.com/support/documentation/ScriptReference/Time-time.html

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by the_Simian · May 13, 2011 at 02:48 PM

There are a number of ways to do this yourself, but i should point out that some very sophisticated methods have been worked out by others.

For one example is Unisky: http://www.sixtimesnothing.com/unisky which does what you want and a lot more: procedural sky, weather, and atmospheric visual effects system.

in any case, heres a stab at a simple script to do what you want:

//set times here

var day_duration:float = (your time here);

//this makes a smooth intensity transition

var phi : float = Time.time / dayduration 2 Mathf.PI; var light_amplitude : float = Mathf.Cos( phi ) * 0.5 + 0.5;

//and this will make the light change.

light.intensity = light_amplitude;

then drag that badboy onto your light. , now it changes.

if you want somethign more sexy: here is a sunlight script out there in the community. http://unifycommunity.com/wiki/index.php?title=SunLight

and your skybox? here is some very good code for fading between two skyboxes: http://www.unifycommunity.com/wiki/index.php?title=SkyboxBlended

and if you don't want to build it all alone, or straight up just buy it... you can do something in between... buy a tutorial!!

http://forum.unity3d.com/threads/47951-Video-Tutorial-Day-amp-Night-Cycle

and voila!

that should cover all your bases, sir!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by MrLolEthan · Oct 15, 2012 at 07:01 PM

 var speed : float = 0.5; 
 //this is the speed your directional light rotates at
 //adjust this to your liking
 
 function Update() {
     transform.Rotate(0,0,speed*Time.deltaTime);
 }

What this script does is rotates the directional light (NEEDS TO BE DIRECTIONAL) and when it rotates it lowers the light. Adjust to your liking. Enjoy!

PS: You can copy and paste that script into a JavaScript file and attach the JavaScript file to the directional light.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Lighting only happening when the player get close. 4 Answers

Point Lights just dont work 3 Answers

lighting click help 3 Answers

Point light shadows broken? 0 Answers

How do I change a spot light to a point light by pressing a key? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges