I’m new on jmonkeyengine development and I’m creating an augmented reality Android app.
So, 3D objects are displayed and move depending on their own position and phone position (gps + sensor).
I want to move directionalLight (sun) to get a realistic result.
For example, if phone date is 2pm, the sun is up, if it 5pm the sun is to the west, etc.
So I need to take care of phone date and phone compass.
I already got those two parameters, but I need a few help to set sun position.
It’s a 3D world (3D objects layer over Android camera in 2D).
Maybe I took me the wrong way ?
In order to set the light position, I need to know where is the east right ?
The sun position (and the direcitonal light) is set in the 3D-world coordinate system. The compass is used to set where the camera is pointing (so nothing to do with the sun position). As pspeed suggests the compass is irrelevant to setting the sun position.
I though OP was asking for math to calculate the sun position given a lat/long and datetime.
I think it’s not so easy.
Because I’m in an AR context, east position depend on phone position…
If the phone is to the north then east is to the left.
If the phone is to the west then east is behind.