Trying to rotate my sun

Hello everyone,

I am trying to rotate my sun but it doesn’t really work.

When I rotate my sun (directional light), the light changes but the actual sun in the sky sphere doesn’t move. Does anyone know how to fix this because it looks weird if it’s night, yet there’s a sun in the sky.

Thank you in advance,

Yaz

I will move this thread into the bp section of the forum. :slight_smile: -> take a look at the wiki, I think there you can find a day/night cycle tutorial which will explains how to change that https://wiki.unrealengine/Main_Page

YOu will have to rebuild the lightning for the actual “sun” to move. At least that’s my solution. Ifyou’re gonna change it’s rotation ingame with a blueprint you have to get a reference to the SkySphere and “update the sun direction” on that one too!

Thanks guys, I’ll try it out :slight_smile:

Hey, I followed the wiki guide and I managed to create a day/night cycle, BUT when I manually try to rotate the sun it still doesn’t work. The light changes appropriately, but the sun does not move along so it looks very weird still. :S Any idea on what I could do? Thanks man!

EDIT: My work mate just tried to do it himself and it didn’t work for him either. Could this be because of the recent update?

If you’re using the default Sky Sphere Blueprint we included, notice that you have to hit the “Refresh Material” checkbox to update the sky in the editor. That’s your giveaway - that means something needs to happen in order to update the sky.

If you open that Blueprint, you’ll see that there is a custom Function called UpdateSunDirection. Go into the Event Graph. Create an “Event Tick” node. Connect that to an UpdateSunDirection function call. You could put a delay on this for performance reasons, especially if your sun moves slowly (as it probably should). Now, if you animate your Light Source (make it moveable!!), the material sun will always move with it.

This is super fast to set up. Give it a try and let me know how it works.

EDIT: Oh, and before I forget, unless you use Delta Time from the tick to help control how much you rotate, then your sun will probably speed up and slow down based on hardware performance! You may or may not notice that depending on how fast the sun is moving, but it’s worth a mention.

FYI, unlike UDK, the visible sun in the sky is actually separate from the lamp, it’s a just white disk shape on the sky’s material. The sky material/blueprint is cleverly designed to position this disk using the sun’s rotation. As Zak said, the material won’t update unless you press that box.

I’ve got a tutorial/template related to this kind of thing here, in case you’re interested.

Thanks for the reply!

I tried ticking Refresh Material, but it didn’t work for some reason?

I have also done the tutorial by Tesla on time of day in UE4, and it works. The sun rotates slowly as time passes, but still, I cannot rotate it the way that I want. I am not sure if that is what you meant me to do, because if yes, then I’ve tried it already :confused:

Thank you, I think I’ll give that one a shot if the thing I’m working on right now doesn’t work out in the end. Cheers!

Newbie question. How do I remove the sun? I realized after the fact I should have chosen the blank blueprint, but now I just want to remove the sun so I can have lights that actually work in my top down. Thanks for the help

Deleting the directional light in the level should do the trick. Just make sure you rebuild lighting afterwards. :slight_smile:

EDIT: Actually that doesn’t seem to work. I think you need to edit the sky material to remove the sun disc part.

Ok I will try editing the sky material. Thanks

Doesn’t work for me in the installed UE4 4.5.1 However in the Github Built latest engine it does work. I think there is a problem with a specific update. should get it fixed cause its one of the first things noobies try to do by themselves, and is a great self esteem blow if something doesn’t work on the very beggining.

Zak, Thanks for the tip on this. This work and updates in game for me, but I would like to rotate the light in the editor and have the sun auto update while (or after) rotating the light. I added the refresh button and that works, but it is kind of a pain to always re select the blueprint and then hit the button every time you move the light. Any help on this would be great! Thanks.

Hello

I am trying to rotate a sun following the unreal tutorial. The sun rotates and I didn’t create a class BP. I just want the sun to rotate after the player enter a trigger zone. Only problem, the sun rotate from another location that its default location from where I placed it (zenith). After placing the BP skysphere that I am using, I modify the sun height to 1 value so the sun it’s at the zenith. However, it’s start its rotation from a lower location. Any advice how to fix this? I believe it’s a getting and setting location problem? Or get a sun heigh variable? kinda lost here. Thanks for the help :slight_smile: