Hello,
There is a strange model-related problem in our project (https://playcanvas.com/project/424770/overview/hotel-showcase). We have two nearly identical mirrors; each consists of a camera and a model to which the mirror texture is applied. The script for the mirror effect is attached to the camera, and name of the “target” model’s node is passed as an attribute.
A somewhat similar error is here (☑ model.meshInstances throwing core error?) but it seems to be related to an entity’s lifetime while in our case it’s the entity’s name that causes problems.
One of the mirrors (in the hallway) works while another (in the bathroom) doesn’t. The script searches for a node like this:
this.mirrorSurface = this.app.root.findByName(this.surfaceName);
this.surface name is currently either “bathroom_mirror” or “hallway_mirror”. The problem is, for the bathroom mirror, “this.mirrorSurface.model” is undefined. Thus, we cannot get meshInstances.
Below are the screenshot of the non-working nodes in the Google Chrome debugger. The node indeed has no “model” property but for some reason has a child named “mirror_body” which our modeller deleted some time ago.
What’s more, we created an exact copy (“bathroom_mirror2”) of the original bathroom_mirror node, attached to it the same model’s JSON file and passed the new name (“bathroom_mirror2”) to our mirror script. The script worked. Then we deleted the original node (“bathroom_mirror”) and renamed our new node to “bathroom_mirror”. The script stopped working with the exact same error.
Our modeller thinks the engine somehow remembered the old info about the deleted model. Of course, the problem is easily solved by renaming the mirror model’s node but we thought this post may help to solve someone else’s problem.