The mesh visibility property cannot be set with an animation in some circumstances

A strange one this that perhaps has something to do with Javascript ‘strict mode’?

In this PG lines 123 - 125 and 127 - 129 work with 136,137 and 144,145 when move button is clicked

In this PG the corresponding lines 21-23, 25 -27 (called from lines 284, 289) produce the error

TypeError: setting getter-only property “visibility”

when Move Up button clicked

Using the code from PG #28 in a local file with the latest preview version of babylon.max.js the error is reported as on line 5733

Changing to an earlier version 4 of babylon.js ( 3 Dec 2018) there are no problems.

As you can see from this version of the PG lines 283 and 290 and this version lines 22,23 there is not a problem setting visibility directly outside the animation call.

This is all expected with instanced meshes.

You should either play the animation on the source mesh or not create it as an instance.

The main point so not have the setter affecting the source is to prevent the confusion of why they all changed.

1 Like