Has there been a recent update to the Playcanvas engine? From yesterday to today two features of my system simply started to give problem without changing anything. I even have an old build with the same code to run those features that keeps running.
Basically I have a 3D tour system with skyboxes and since today, their texture only loads after I load it 2 times.
The other problem is in the layers. I have a piece of code that manually sets the layer of certain objects and now has time that works and time that does not
There are two problems that have arisen on last update:
1: When you click at on blue circle, the application loads a texture and bind it to a skybox. Now at the first click, the texture doesn’t load and the screen came black.The strange thing is that the second skybox clicked works.
When in FirstPerson view (click on any blue circle to enter), the added objects must be setted to another layer and each one have a script attached that do it, but this code is only working at the 2th to 3th addition.
The code attached to set layer manually is:
var SetLayer = pc.createScript('setLayer');
// initialize code called once per entity
SetLayer.prototype.initialize = function() {
var meshInstances = this.entity.model.meshInstances;
for(var i = 0; i < meshInstances.length;i++){
// enable depth order rendering
var instance = meshInstances[i];
var mat = instance.material;
mat.blendType = pc.BLEND_NORMAL; // render sphere also after all opaque objects
instance.layer -= 2; // but force it to be rendered always after occluders
}
};
I was hired four months ago to continue the development of this software and it worked that way. If i change to your code, tthe software start to run correctly again, but causes some glitch that blinks screens with the new texture.
I have updated skybox-load.js and I believe it works now (I also had to change your other calls to setParameter in the script). Can you let me know if the app is now working correctly.
Great!! The app is working fine, but the objects that i can add dynamically still not visible until add 2 of them. Let me explain: When you add an object, it became invisible at the FirstPerson view camera. Only when you add two they became visible beyond the skybox. I’ll try to fix this later, but if you can look at this will be a great help
I tried a lot of things but the problem persists. I don’t know why the player only set the right layer to a new object when I add a second one. Made this, the first and second objects added become visible together. Is there a function that i’m missing to call? Maybe a recalculate layers or draw order?
The addition code is located in editor-3d.js at Editor3d.prototype.addObject
The addition of objects worked before yes, I don’t know why it broked.
As I said, I got the system development in the middle of the way and the layers were already made that way, but your tip already solved the problem! I changed the way I set the layers to the pc.ModelComponent and it worked!!