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.