# Texture rotation resets after full rotation

**URL:** <https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [January 2, 2025, 9:33pm UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498 "2025-01-02T21:33:31Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricardo22448](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ricardo22448](https://forums.unrealengine.com/u/ricardo22448)\
**Post date:** [January 2, 2025, 9:33pm UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498/1 "2025-01-02T21:33:32Z")

</div>

Hi all,

I have a day and night cycle but when the moon reaches 24(midnight) then it suddenly resets the rotation to the 0 position. how can i change this so that the moon rotates to the 0 position?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/3/2/23223b53949ac32a2c1e7b589a498c40c8e3d7d3.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/c/3/bc314c9b916ce28b4aed637029ae1a89ef131ac6.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/d/0/3d0cd50c014dd40c53062a6e62cb9de7fb3a019d.jpeg) 24( this is the 0 state)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/f/d/2fdab5059d707073b8f6d95c2ddef5317c766ab3.jpeg)23(this is just before full rotation

hope someone can help! thank you!

---

<div class="post-metadata">

**Author:** ![ricardo22448](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ricardo22448](https://forums.unrealengine.com/u/ricardo22448)\
**Post date:** [January 3, 2025, 8:51pm UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498/2 "2025-01-03T20:51:28Z")

</div>

Someone know why this happens? it rotates the z from 0 to 180 is there a way to lock this? it is the directional light

---

<div class="post-metadata">

**Author:** ![fliprly](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fliprly/32/1013710_2.png) [@fliprly](https://forums.unrealengine.com/u/fliprly)\
**Post date:** [January 3, 2025, 9:21pm UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498/3 "2025-01-03T21:21:34Z")

</div>

Which direction your are spinning?

---

<div class="post-metadata">

**Author:** ![fhaab](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fhaab](https://forums.unrealengine.com/u/fhaab)\
**Post date:** [January 3, 2025, 9:27pm UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498/4 "2025-01-03T21:27:09Z")

</div>

I think it’s your time of day comparison.

If time of day crosses midnight, it’s resetting to 00:00:00, which is before Dusk.

The comparison should be (TimeOfDay \> Dusk) OR (TimeOfDay \< Dawn)?

---

<div class="post-metadata">

**Author:** ![ricardo22448](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ricardo22448](https://forums.unrealengine.com/u/ricardo22448)\
**Post date:** [January 3, 2025, 11:22pm UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498/5 "2025-01-03T23:22:36Z")

</div>

hi!

i made it somewhat easier to put the moon cycle on a 24 to 48 hour , the sun goes from 0 to -180 and the moon goes to -180 to 0

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/7/0/370b643892b24c82f2006485a9686bfa36998f0a.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/e/0/ae014029fa788e86a98302fb436deba295103acf.png)  
so what i see is that after hour 37 the moon directional light suddenly flips from 0 to 180  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/5/9/559d12cbc45b1de158eb3f94f58431da0e5743ae.jpeg)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/b/6/4b669aa0ff03aad4a58aecd0249d74e4f3d67f24.png)  
up image is time of day 35

down image is 37 and rotation z is suddenly 180

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/4/a/14aeb96c6f8195f97c24105bb60993512f346e91.jpeg)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/1/1/3117d1f89a14da055770d2b3fab7fa792dae7c72.png)

the same thing happens with the sun at the highest point it suddenly flips on the rotational z 180 degrees. but you just cannot see it because it has no texture

---

<div class="post-metadata">

**Author:** ![ricardo22448](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ricardo22448](https://forums.unrealengine.com/u/ricardo22448)\
**Post date:** [January 3, 2025, 11:24pm UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498/6 "2025-01-03T23:24:27Z")

</div>

plz see comment above

---

<div class="post-metadata">

**Author:** ![fhaab](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fhaab](https://forums.unrealengine.com/u/fhaab)\
**Post date:** [January 4, 2025, 5:32pm UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498/7 "2025-01-04T17:32:42Z")

</div>

So I’m not going to wire all this up and test it, but I certainly have had problems with rotations and Unreal making the equivalence that -180 = 180, that -10 = 350, etc.

So can you try adjusting your ranges, instead of 0 to -180, and -180 to 0, doing 360 to 180, and 180 to 360?

---

<div class="post-metadata">

**Author:** ![ricardo22448](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ricardo22448](https://forums.unrealengine.com/u/ricardo22448)\
**Post date:** [January 4, 2025, 5:46pm UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498/8 "2025-01-04T17:46:29Z")

</div>

Thank you for your answer, i will try this and get back to you!

---

<div class="post-metadata">

**Author:** ![ricardo22448](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ricardo22448](https://forums.unrealengine.com/u/ricardo22448)\
**Post date:** [January 4, 2025, 6:29pm UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498/9 "2025-01-04T18:29:25Z")

</div>

Hey i tried it but it is the same at the half point the directional light suddenly turn to negative.

i made a new blueprint with only sky atmosphere and a directional light an on the light with the property Forward Shading Priority on one, i changed nothing else.

then i just made a float with the range of 0 to 24 and the following components that fire from the constructor script :

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/c/f8c8d037126165c1e54dc90c50b3650d8a19b2de.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/e/2/de27ac1c952dd6e542b6047701fae370a8c3107b.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/0/6/006cd2adc46cf6c8b08f8a9574d6afe1d6bc6e3a.png)  
when i put the blueprint in my scene and go to the 0 time:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/9/9/c996735db5f873955482f0e97d8d3da17c213e0e.png)  
then i see the directional light on 180 on the z rotation axis  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/6/d/66d827469fa2dbddde633a778081ec88c786ae49.png)  
then when i go to a half point like day of time 12:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/5/b/f5b76033637f85ac8958c88ebef2a8708ddab16b.png)  
the directional light suddenly goes to - 180 on the z axis :  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/f/2/bf2e3352133f73b1cd8af57e690779c8aef9d625.png)

very weird that this happens

---

<div class="post-metadata">

**Author:** ![fhaab](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fhaab](https://forums.unrealengine.com/u/fhaab)\
**Post date:** [January 4, 2025, 6:41pm UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498/10 "2025-01-04T18:41:06Z")

</div>

I’m not sure what the problem is, but I still think one problem is your range of 0-24 mapping (now) to 180 to 360; if your value rolls over from 24 back to 0 at midnight, the rotation will snap back to 180.

The other thing is I feel like you shouldn’t be “adding” instead of “setting” the world rotation.

---

<div class="post-metadata">

**Author:** ![ricardo22448](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ricardo22448](https://forums.unrealengine.com/u/ricardo22448)\
**Post date:** [January 4, 2025, 7:19pm UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498/11 "2025-01-04T19:19:18Z")

</div>

its maybe something with the engine because i now set the range like this 0 to 360 and i do set the world rotation now:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/1/0/110f85f359fc2c2515b2b1cd474c1eaac0c8335d.png)  
now on the time of day 180  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/f/8/ef8c503a0bfc9370ca87a7009803df326f474852.png)

the direction z axis is -180

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/9/0/5900b2ad8e1c216ad30fdad81c88347a24d3b4ab.png)

if i place the world time on 181 :

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/b/a/eba3d1eec9875075871d5d34b1f707e2ef13f941.png)

exactly after the half point the direction z axis goes to 0:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/6/c/26ccbcfc85799315bfd97531540da574c0313d7b.png)

every halfpoint (highest in the sky point) it changes to negative or 0

very weird

---

<div class="post-metadata">

**Author:** ![PhileRain](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PhileRain](https://forums.unrealengine.com/u/PhileRain)\
**Post date:** [July 24, 2026, 6:31am UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498/12 "2026-07-24T06:31:34Z")

</div>

The problem lies in the Material, not the Blueprint. Can you take a photo of the material and post it here to see if I can solve this problem?

---

<div class="post-metadata">

**Author:** ![illspiritx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@illspiritx](https://forums.unrealengine.com/u/illspiritx)\
**Post date:** [July 25, 2026, 8:18pm UTC](https://forums.unrealengine.com/t/texture-rotation-resets-after-full-rotation/2256498/14 "2026-07-25T20:18:42Z")

</div>

If you’re trying do do a lunar cycle. you should probably keep track of the number of days elapsed. Like wherever you flip time of day from 24 to 0 in tick, increment (++) a “day number” int var.

Then when you set moon directional light’s pitch do math on day number _\* or / by delta time/day length (basically same math as setting Time of Day) to figure out moon “time.” Plug that into a map range with out min 0 and max of (number of days in lunar cycle)\*360 , or cheat and use_ 10800 for a 30 day cycle. Plug that range output into pitch. Engine should track the extreme pitch value and auto map it to 0-360.
