Jump to content

[SOLVED] Sun position (rotation) from direction vector


photo

Recommended Posts

Posted

Hi,
I've got direction vector that describes sun position in my app. I'm trying to use this vector to set proper sun rotation in Unigine (LightWorld::setWorldRotation). Is there any example how can I do this? Could you help me a little bit?
I've tried to use Unigine::Math::lookAt but no luck - it doesn't work as I would expect.

Posted

Hi @arzezniczak,

A similar task was solved here, please, take a look: https://developer.unigine.com/forum/topic/4530-real-sun-position/?do=findComment&comment=23617

UPD

This thread also may be useful: https://developer.unigine.com/forum/topic/5201-solved-widget-update-sun-position/

Please let us know if none of them helps.

Thank you.

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

Problem solved, provided links were very helpful.
I've been able to calculate azimuth and elevation from my direction vector, then I'm using it to build rotation quaternion.

Thank you!

  • morbid changed the title to [SOLVED] Sun position (rotation) from direction vector
×
×
  • Create New...