Jump to content

Rotate Sun to set the morning view, afternoon view, and night view


Recommended Posts

Hello, i'm still a newbie in this c# coding, i want to ask about how to set the rotation of the sun object so that it can display morning, noon, and night in c# code.

Link to comment

Hello @Dentaawp,

You can set the rotation of any node by means of the SetRotation(quat q) method:

vec3 EulerAngles = vec3.ZERO;
mat4 rot = MathLib.ComposeRotationXYZ(EulerAngles);
node.SetWorldRotation(new quat(rot));

I'd also suggest to take a look at the Transformation section of the C# Component Samples to get familiar with rotation composition/decomposition. The Programming Quick Start series also might help with basic concepts.


Link to comment
  • Create New...