Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008772opensim[REGION] Script Functionspublic2020-09-13 04:362020-09-21 07:22
Reportertglion 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusnewResolutionopen 
PlatformLinuxOSOS VersionUbuntu 19.04
Product Version 
Target VersionFixed in Version 
Summary0008772: llGetSunDirection() returns always <0,0,0>
DescriptionNext Problem:
vector v = llGetSunDirection();
returns every time <0,0,0>
Is still something wrong in my configuration?
Steps To ReproduceRun a test-script with:
vector v = llGetSunDirection();
llOwnerSay("v = "+(string)v);
TagsNo tags attached.
Git Revision or version numberb929a2004542db3628d5e7392c3b6ab13f4ea913
Run Mode Grid (1 Region per Sim)
Physics EngineubODE
Script EngineXEngine
EnvironmentMono / Linux64
Mono Version6.x
ViewerSingularity Viewer
Attached Files

- Relationships

-  Notes
(0036851)
Luisillo_Contepomi (reporter)
2020-09-13 09:45
edited on: 2020-09-13 09:45

I test with this script and modify with viewer from day to night to verify behavior.
I have day = 1 or night = 0
(<0,0,1> or <0,0,0> respectively )


//---------------------
default {
   state_entry() {
      llSetTimerEvent(5);
   }

   timer() {
      vector sun = llGetSunDirection();
         if(sun.z < 1) {
             llOwnerSay((string)sun.z +"night");
                     }
         else {
             llOwnerSay((string)sun.z + "day");
         }
   }
}
//------------------

(0036852)
tglion (reporter)
2020-09-13 23:46
edited on: 2020-09-13 23:50

Yes this is wrong, I await output like this:

Object: v = <-0.66981, 0.00000, 0.74253>

x = float value between -1 to 1 (Sunposition east to west or it is an angle?)
y (south/north angle) seem not implemented in SecondLife too ;-)
z = sun hight(angle) as float (not simple 1 or 0). <0 at night >0 at day.

(Tested in Second Life)

(0036853)
UbitUmarov (administrator)
2020-09-14 11:59
edited on: 2020-09-14 13:10

what you expect is not the spec.
"Returns a normalized vector to the current sun position at..."
http://wiki.secondlife.com/wiki/LlGetSunDirection [^]

and it does return values other than <0,0,0> for me...

currently at opensimulator sun and moon are considered at infinity, so altitude and prim position are irrelevant for the vector.
position does select the relevant (parcel or region) environment, ofc.
 y= 0, because usual simple sun only moves on y = o plane

(0036854)
tglion (reporter)
2020-09-14 13:02

No, thats not true, what I expect is the spec. I think it is something like this:
<sin(x angle), sin(y angle>, sin(z angle)>
Normalized float vector, yes.
But I am not the high expert on math here.
But the output from opensim commit b929a20... is definetly wrong in my eyes!
I get for x every time 0, that is bad. That should be fixed, if I don't have a big issue in my configuration on opensim.
In SecondLife y is always 0 because the sun is only going like on
equator straigt from east to west. That is not nice, but no problem.

The spec from SL is very small here. But the real SL implementation differ to opensim currently. In the past it was correct, but since EEP update it is wrong now. :-(
(0036855)
UbitUmarov (administrator)
2020-09-14 13:06
edited on: 2020-09-14 13:22

any normalized vector is also (cos alpha, cos beta, cos gamma)
not sin.

as i said, it is seems working fine on my tests, and according to our specs, not any ideas you may have about those.

i.e. returns a normalized vector pointing to the sun valid for the prim position, assuming sun is located at infinity

sun at infinity means that position on region is only relevant to find the right environment.

(0036856)
tglion (reporter)
2020-09-14 13:27
edited on: 2020-09-14 13:29

Sorry, I don't understand, what you try to tell me.
Maybe it is cos, but that is not the point, what correct math it should do. You know it better than me maybe. I don't know it axacty. The Point is, I get every time for x 0.0, but it should something like between -1 to +1. same for z
A inworld script I used for years in the past is now useless. :-(

(0036858)
UbitUmarov (administrator)
2020-09-14 13:32
edited on: 2020-09-14 13:33

well, i can't repo your issue
i did get correct values on the few tests i did
lbsa: <0,0,1> with fixed midday sun
etc.

(0036859)
tglion (reporter)
2020-09-14 13:32

You want to tell me it is correct, that I get every time 0 for x and 0 or 1 for z? That makes no sense for me sorry.
(0036860)
UbitUmarov (administrator)
2020-09-14 13:36
edited on: 2020-09-14 13:37

<0.070756, -0.979680, -0.187673>
<0.240336, -0.928977, -0.281498>
at different times on parcel with more complex daycycle...

(0036861)
tglion (reporter)
2020-09-14 13:40

Mhhh, but why it is not working on my side?
(0036862)
tglion (reporter)
2020-09-14 13:41

I try to debug this in the next days. :P
(0036863)
tampa (reporter)
2020-09-14 16:30

[16:29] Object: -0.705433night
[16:29] Object: -0.706979night
[16:30] Object: -0.708522night

Running master code and your script from above.
(0036864)
UbitUmarov (administrator)
2020-09-14 16:37
edited on: 2020-09-15 01:28

correct test is
vector sun = llGetSunDirection();
if(sun.z > 0)
 do day things
else
 do night things

(0036865)
tglion (reporter)
2020-09-15 00:57

That is not my script ;-)

That, what I have done:

git checkout -f b929a2004542db3628d5e7392c3b6ab13f4ea913

./runprebuild.sh

msbuild -maxcpucount:4 -m:4 -nr:false -p:Configuration=Debug
No Errors

cd bin/ScriptEngines

ls -l
drwxr-xr-x 2 osim users 20480 Sep 15 09:09 08501b1b-8fdb-4e0f-8f58-1eaf7e1656ef
rm -rf 08501b1b-8fdb-4e0f-8f58-1eaf7e1656ef/
cd ..

mono --debug OpenSim.exe

Starts with no errors, only this warnings after first login to this region:
09:15:07 - [AVFACTORY]: Can't find inventory item db5a4e5f-9da3-44c8-992d-1181c5795498 for Skin, setting to default
09:15:07 - [AVFACTORY]: Can't find inventory item 6969c7cc-f72f-4a76-a19b-c293cce8ce4f for Hair, setting to default
09:15:07 - [AVFACTORY]: Can't find inventory item 7999702b-b291-48f9-8903-c91dfb828408 for Eyes, setting to default
09:15:07 - [AVFACTORY]: Can't find inventory item 566cb59e-ef60-41d7-bfa6-e0f293fbea40 for Shirt, setting to default

Rezzed a new cube
Created this Script in it:
default {
    state_entry() {
    }
    touch_start(integer num) {
        vector v = llGetSunDirection();
        llOwnerSay("v = "+(string)v);
    }
}
Saved it.

Its currently day in this region.

Clicked the cube:
Output:
[00:35] Object: Script running
[00:35] Object: v = <0.000000, 0.000000, 0.000000>

I am helpless, what do I missing here?
(0036866)
UbitUmarov (administrator)
2020-09-15 01:43
edited on: 2020-09-15 01:45

do a region environment change to make sure region db did update. A older viewer will only change region environment setting.

region environment edit should now be done with a eep viewer like fs beta
https://wiki.firestormviewer.org/fs_eep_beta_downloads [^]

so one can see the full new set of features.
doing composition one must check how things look on wl users, other ppl will use.

singularity was not a good choice, last time i checked

(0036867)
djphil (reporter)
2020-09-15 01:58

It work just fine of my point of view :)

[01:57] Object: v = <0.854995, 0.000000, 0.518636>
[01:57] Object: v = <0.853523, 0.000000, 0.521056>
[01:57] Object: v = <0.853100, 0.000000, 0.521748>
(0036868)
UbitUmarov (administrator)
2020-09-15 02:15

looking to code a value <0,0,0> happens if code can not find a track to do the position (actually rotation) math..
(0036869)
tglion (reporter)
2020-09-15 02:21

djphil, what Operating System do you use for opensim region?

Can it to do something with my linux version, does not supporting something?
What can I do to fix that? I can't use Windows for it!

Ubit, I have tried firestorm fs_eep_beta, but I am not able to login to my grid with it. Only Secondlife.
"Viewer Menu ? Preferences ? Advanced ? Allow login to other grids" is enabled, as described on this download-page.

But I currently don't understand what this viewer relate to my actual problem?

This should work by default !!!!!!
(0036870)
djphil (reporter)
2020-09-15 02:23

Win 10 + OS Master + FS Beta
(0036871)
tglion (reporter)
2020-09-15 02:34
edited on: 2020-09-15 02:34

Which .cs File does the calculation for sundirection vector? I wan't try to look at it, to see why its going wrong in my case...

(0036872)
tglion (reporter)
2020-09-15 02:37
edited on: 2020-09-15 02:40

Ubit, which operating system do you used while testing that. Have you tested that in linux environment too (like Ubuntu)?

(0036873)
UbitUmarov (administrator)
2020-09-15 02:39

you need the version for opensimulator.
and not related, i did mention it because i did ask you to change the region environment and a eep viewer allows to see more things, like parcels state.

but you can change the day cycle and water on a older viewer (and pray :p )
(0036874)
tglion (reporter)
2020-09-15 02:45

Mhhhh, I can change daycycle by script, this currently working for me (it seem so).

osReplaceRegionEnvironment(0, "", 24, 1, -1, -1, -1); seem to be working.

And llGetSunDirection() not :-(
(0036875)
UbitUmarov (administrator)
2020-09-15 02:51
edited on: 2020-09-15 02:52

on sources updates, it is safer to clean the solution before git pull or chechout

source files
lsl_api.cs
EnvironmentModule.cs
ViewerSky.cs

(0036876)
tglion (reporter)
2020-09-15 03:16

Ok, had downloaded the wrong viewer.
If I login to firestorm viewer I get something like this message:

Could not load settings for
5646d39e-d3d7-6aff-ed71-30fc87d64a91 from the database.
                [close]

even I try: World->Environment->Sunrise
or the other ones. (With other uuid's)

What do I missing here, and how can I fix this?
(0036877)
tglion (reporter)
2020-09-15 03:21

ok, I try now to delete the whole source-tree before git pull and do then run prebuild and compile. I let you know, if this success or not.
(0036878)
tglion (reporter)
2020-09-15 03:28

No, that was not the problem. :-( Same issue.
(0036879)
UbitUmarov (administrator)
2020-09-15 03:39
edited on: 2020-09-15 03:40

you are missing assets grid side.
new robust with one of the core assets services should update them automatically
with older, if you have HG, just tp to osgrid LBSA and get a copy of the little prim near the dancing eng. HG things will do the rest

for testing you can also temporary load those directly to the region cache doing:
fcache cachedefaultassets

one of those is actually the default environment, so could be the cause of this issue

(0036880)
tglion (reporter)
2020-09-15 04:21

ok, thanks, I will try this...
(0036881)
tglion (reporter)
2020-09-15 10:00

I have updated the robust and done the "fcache cachedefaultassets"
The asset error-message is gone now. That is litle it better now.

But it seem now the sun is frozen on position and not moving anymore.
The script does now following output:
[09:42] Object: v = <0.901410, 0.282051, 0.328492>
[09:43] Object: v = <0.901410, 0.282051, 0.328492>
[09:44] Object: v = <0.901410, 0.282051, 0.328492>
[09:44] Object: v = <0.901410, 0.282051, 0.328492>

Wow, I can replace the sun with betelgeuse-Texture ;-)

I have tried to set to Default settings in the Estate-Environmentsettings (with the Firestorm-Viewer). But this does not change anything.

I get an error in log, if I click the "Reset"-Button:
18:44:37 - [Environment DeepImpact] failed to store Environment Abort due to constraint violation
18:44:37 - [Environment DeepImpact] failed to store Environment Update requires a valid DeleteCommand when passed DataRow collection with deleted rows.

Any ideas?
(0036882)
UbitUmarov (administrator)
2020-09-15 10:39
edited on: 2020-09-15 10:45

to sun to move you need to add "skies" to the track, etc
our default should move the sun
if you did update robust, you should have simple things on OpenSim library also. There should be no need to run that fcache comand with updated robust
you can test robust by deleting them from the cache with the command
fcache deletedefaultassets
and viewer cache..
how to setup environment is out the scope of mantis, glad it now works for you
keep in mind older viewers will not show betelgeuse

(0036885)
tglion (reporter)
2020-09-21 02:46

After some tests:
Modifications on environment works only on latest Firestorm.
- I have still issues if I use sqlite as datastore in the simulator. (still a bug there?)
- mysql seems to work.
But some criticisms and wishes:
- If I set textures for sun or moon, there are still no movement is possible, there are all at static position? Is this by design, or will this work in the future?
- Is there a way to implement an os-function to set the sunposition as normalized vector <x,y,z> for x,y,z [-1 ... 1] or as radiant [-PI .. +PI]? So I am able to simulate the sun-movement with an script for e.g. on North-pole in the summer (rotating on the sky with no night)? (Only my ideas ;-)))
(0036886)
UbitUmarov (administrator)
2020-09-21 04:51

all movements are done by entries on the environment tracks. each entry sets a position, viewers do interpolation between those ( and most parameters), based on their utc time.
(0036887)
tglion (reporter)
2020-09-21 07:22
edited on: 2020-09-21 08:37

But this is not working well in my eyes. I still see a lot of room for improvements there. (Only my opinion about that, you can close this mantis as resolved, if you want)


- Issue History
Date Modified Username Field Change
2020-09-13 04:36 tglion New Issue
2020-09-13 09:45 Luisillo_Contepomi Note Added: 0036851
2020-09-13 09:45 Luisillo_Contepomi Note Edited: 0036851 View Revisions
2020-09-13 23:46 tglion Note Added: 0036852
2020-09-13 23:50 tglion Note Edited: 0036852 View Revisions
2020-09-14 11:59 UbitUmarov Note Added: 0036853
2020-09-14 12:44 UbitUmarov Note Edited: 0036853 View Revisions
2020-09-14 12:49 UbitUmarov Note Edited: 0036853 View Revisions
2020-09-14 12:55 UbitUmarov Note Edited: 0036853 View Revisions
2020-09-14 13:02 tglion Note Added: 0036854
2020-09-14 13:06 UbitUmarov Note Added: 0036855
2020-09-14 13:10 UbitUmarov Note Edited: 0036853 View Revisions
2020-09-14 13:18 UbitUmarov Note Edited: 0036855 View Revisions
2020-09-14 13:22 UbitUmarov Note Edited: 0036855 View Revisions
2020-09-14 13:27 tglion Note Added: 0036856
2020-09-14 13:28 UbitUmarov Note Added: 0036857
2020-09-14 13:29 tglion Note Edited: 0036856 View Revisions
2020-09-14 13:30 UbitUmarov Note Deleted: 0036857
2020-09-14 13:32 UbitUmarov Note Added: 0036858
2020-09-14 13:32 tglion Note Added: 0036859
2020-09-14 13:33 UbitUmarov Note Edited: 0036858 View Revisions
2020-09-14 13:36 UbitUmarov Note Added: 0036860
2020-09-14 13:37 UbitUmarov Note Edited: 0036860 View Revisions
2020-09-14 13:40 tglion Note Added: 0036861
2020-09-14 13:41 tglion Note Added: 0036862
2020-09-14 16:30 tampa Note Added: 0036863
2020-09-14 16:37 UbitUmarov Note Added: 0036864
2020-09-14 17:15 UbitUmarov Note Edited: 0036864 View Revisions
2020-09-14 17:15 UbitUmarov Note Edited: 0036864 View Revisions
2020-09-15 00:57 tglion Note Added: 0036865
2020-09-15 01:27 UbitUmarov Note Edited: 0036864 View Revisions
2020-09-15 01:28 UbitUmarov Note Edited: 0036864 View Revisions
2020-09-15 01:43 UbitUmarov Note Added: 0036866
2020-09-15 01:45 UbitUmarov Note Edited: 0036866 View Revisions
2020-09-15 01:58 djphil Note Added: 0036867
2020-09-15 02:15 UbitUmarov Note Added: 0036868
2020-09-15 02:21 tglion Note Added: 0036869
2020-09-15 02:23 djphil Note Added: 0036870
2020-09-15 02:34 tglion Note Added: 0036871
2020-09-15 02:34 tglion Note Edited: 0036871 View Revisions
2020-09-15 02:37 tglion Note Added: 0036872
2020-09-15 02:39 UbitUmarov Note Added: 0036873
2020-09-15 02:40 tglion Note Edited: 0036872 View Revisions
2020-09-15 02:45 tglion Note Added: 0036874
2020-09-15 02:51 UbitUmarov Note Added: 0036875
2020-09-15 02:52 UbitUmarov Note Edited: 0036875 View Revisions
2020-09-15 03:16 tglion Note Added: 0036876
2020-09-15 03:21 tglion Note Added: 0036877
2020-09-15 03:28 tglion Note Added: 0036878
2020-09-15 03:39 UbitUmarov Note Added: 0036879
2020-09-15 03:40 UbitUmarov Note Edited: 0036879 View Revisions
2020-09-15 04:21 tglion Note Added: 0036880
2020-09-15 10:00 tglion Note Added: 0036881
2020-09-15 10:39 UbitUmarov Note Added: 0036882
2020-09-15 10:45 UbitUmarov Note Edited: 0036882 View Revisions
2020-09-21 02:46 tglion Note Added: 0036885
2020-09-21 04:51 UbitUmarov Note Added: 0036886
2020-09-21 07:22 tglion Note Added: 0036887
2020-09-21 08:37 tglion Note Edited: 0036887 View Revisions


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker