PhotoDome and variable does not work for the relative path?

// clickedMesh typeof check earlier in the code confirms it's a 'string'
// Also, this works outside of a Switch..Case statement, but not inside when comparing clickedMesh to the actual string in single or double quotes. Why?
// clickedMesh confirmed to be a string exactly as the ImageHere.jpg
// Sorry, no PG as the image is on our server (CORS issue). Fire up the documentation PG for PhotoDome and adjust to test, help
// I also created a function and tried to call that from the case areas, that did not work

dome = new PhotoDome(
  "locationDome",
  './assets/' + clickedMesh + '.jpg', // using a variable (clickedMesh) confirmed with typeof as a 'string', does not work. Why?
  // './assets/ImageHere.jpg', // manually typed in works
  {
      resolution: 32,
      size: 1000,
      useDirectMapping: false
  },
  SecondScene
);

Could you try to console.log(clickedMesh) before you create a new PhotoDome and see the result?

1 Like

Thanks @labris, I have been doing that to make sure the variable is what was expected. I even console.log() it right above the ā€˜url_goes_here_I_typedā€™ string. They match perfectly when I check the browser console area. Iā€™ve never seen this when working with variables in JS or C# for that matter. I thought I was overlooking something simple. Maybe I still am?

And what is the error which you get? 404?

Good question. I donā€™t see an error.

Maybe it is there? :slight_smile:

1 Like

@labris, I had a filter still in the console related field. You are correct. 404.

I wonder if there is another approach, Iā€™ll need to take to get this working then? I should add, ā€˜undefined.jpgā€™ is what Iā€™m seeing for the 404. Because it cannot properly parse that variable you believe?

Well, it works in PG - https://playground.babylonjs.com/#14KRGG#724

2 Likes

Thatā€™s interesting. Now Iā€™m really wondering what different I might be doing. I just side-by-side the two and donā€™t see a different pattern, issue that would break my code.

Thanks @labris.

You may check if the dome and the texture are there - https://playground.babylonjs.com/#14KRGG#726

dome.onLoadObservable.add(function(){
    console.log(dome)
    console.log(dome.texture.name)
})
2 Likes

Thanks @labris. It is listed as the dome.texture.name, path I set in the variable.

So you just donā€™t see the dome for some reasons or the path was wrong?

I donā€™t see the dome with image unless I supply the manually typed out relative path.

Can you share a repro of your project with us? Might be something with how you set up the path serving?

1 Like

I wish I could. Itā€™s got quite a bit going on and itā€™s for internal consumption. I have a feeling Iā€™m just going to have to drive through this one myself. Feels like ordering of what Iā€™m doing. I may have to rip these scenes apart and try again. Iā€™ve worked on this for several hours already trying to fix the issue. However, I appreciate the help so far.

One thing I was wondering. Iā€™m trying to use variables across scenes. Is that an issue? Anything I should be mindful when doing?

Javascript variables? What do they refer to? If itā€™s to objects that arenā€™t associated to a scene, like plain js (strings, numers), etc, or Color3, or Vectors, there shouldnā€™t be any problems.

1 Like

Thank you @carolhmj. I just wanted to make sure when I change scenes that variables are not ā€œdestroyed?ā€

If they arenā€™t associated with a scene, they shouldnā€™t be :smiley:

1 Like

Still not able to get this to work.

scene1.onPointerUp = function (evt, pickResult){ā€¦

After a click and up on the mouse pickResult?.pickedMesh?.name is put in a (string) variable. I did a typeof check and itā€™s a string. Itā€™s the name an imported mesh. So seems good so far.

But when I do the following, the PhotoDome will not allow me to use variables in the line that takes the image path.

if (clickedMesh=== ā€˜AnImageā€™){
console.log(ā€œclickedMesh conditional is true!ā€);

    // create the PhotoDome here does not work with a URL for the image containing a concatenated string (quoted strings on left and right, variable in the middle)
  }

If I commented out the conditional check, it works. Why?

I do not of course have the onPointerUp (mouse is up after a click) included in the following PG. But this is the next part that works in this PG.