1
\$\begingroup\$

My project has a Light Source and a Sky Sphere Blueprint.

The rotation on the y axis (Light Source) defines the position of the sun (Sky Sphere Blueprint).

Character Blueprint (increases by 10 degrees on the y-axis rotation of Light Source, the updates the position of the sun):

enter image description here

When you click the button (Angulo, circled in pink), the angle increases by 10 and works to a certain moment:

enter image description here

Image with angle increased by 10:

enter image description here

When it reaches 100 degrees, it starts to go wrong. Each time I click the button it goes from 90 to 100 and vice versa in an infinite loop:

enter image description here

enter image description here

I've already tried to turn it around, subtracting instead of adding, but at one point it also gives error (in the case with 110 degrees).

\$\endgroup\$
3
  • \$\begingroup\$ Sounds like you might be experiencing an issue of angle wrap-around when using Euler angles, similar to this issue a user encountered using these angles in Unity. \$\endgroup\$
    – DMGregory
    Jul 15 '19 at 2:10
  • \$\begingroup\$ @DMGregory I saw your answer and it opened my mind, helping me find a solution. Soon I will post how I solved my specific problem. \$\endgroup\$ Jul 15 '19 at 22:41
  • \$\begingroup\$ @DMGregory I posted a answer based on the help I received through your comment and answer. Feel free to complement it or post your own answer if you wish. \$\endgroup\$ Jul 16 '19 at 23:07
0
\$\begingroup\$

Based on @DMGregory comment and also on his answer given in another question.

Question link where he gave the answer that helped me:

Why rotating an object only on its local X axis result in sudden 180 degrees changes in Y and Z axis rotation values

I stopped using the value coming from the rotation of Light Source. I have stored the desired value in a variable and set it directly in the rotation of the Light Source.

First I did a test using a switch and it worked:

enter image description here

To optimize this, I used a structure and a data table:

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.