Jump to content

Mesh vs AbstractMesh

Art Vandelay

Recommended Posts

I have never used it directly, but often need to declare it in TypeScript in function parameters for Typing, ie: for PickingInfo.pickedMesh:

Here is an example of current state of VR Experience Helper (may change before 3.1 final) for setting a predicate for selection:

let experienceHelper = new BABYLON.VRExperienceHelper(scene);
experienceHelper.onNewMeshSelected.add((mesh: BABYLON.AbstractMesh, eventState: BABYLON.EventState) : void => {
  console.log('selected', mesh.name, mesh.isPickable)

If I was in JavaScript would not be using AbstractMesh, though.  If you don't know the difference - TypeScript transpiles down to JavaScript and all the typing information is lost anyway.

Also, would say that having "Abstract" in the name of the class is a good indication that you would not create your own instances (ie: abstract classes cannot be instantiated).

Link to comment
Share on other sites

AbstractMesh is selected here because all Meshes derive from it. We already had an internal discussion about the name, which all of us kind'a agree - It is not the most fortunate name. Having said that - it will not be changed. You can always cast to Mesh (if you feel like it will look better in code).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...