I’m using the scene loader function to import a mesh and it doesn’t have a position attribute. I found out the function returns an abstract mesh, why does it do that instead of a mesh? What’s the difference?
BABYLON.SceneLoader.ImportMesh("", "assets/models/", "something.babylon", scene, function (meshes, particleSystems, skeletons) {}
AbstractMesh is the base class for both Mesh and InstancedMesh, so by using a param (or return type) of type AbstractMesh it can be either a Mesh or an InstancedMesh. If you’re using TS and know that it’s a Mesh you can cast it like below for example and then access all of the Mesh properties and functions.
// cast just the first mesh
const mesh = newMeshes[0] as BABYLON.Mesh;
// cast a whole array of meshes
const meshes = newMeshes as Array<BABYLON.Mesh>;
EDIT: that said, position is a property of AbstractMesh so you should be able to access that one without casting.