// 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?
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?
@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
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)
})
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?
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.
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
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.