Quantcast
Channel: Babylon.js
Viewing all articles
Browse latest Browse all 388

Accessing containing ES6 class from mesh hits by extending mesh.

$
0
0

Hi, I can execute local functions fine but when I do a pick on the scene there is not a way to access the objects that are siblings to the mesh like this.isSelected.

Is the best way to solve this to add the parent class as a new property on the mesh, ie doing:

  constructor(scene, isOwn, isSelected = false) {

    this.mesh = BABYLON.Mesh.CreateSphere("sphere1", 8, Common.MEDIUM_UNIT_SIZE, scene);
    this.mesh.parentClass = this;

Then I can access the parentClass from the mesh object. Will this work/is it a good idea?


Viewing all articles
Browse latest Browse all 388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>