I am getting an error with the latest Alpha (v21) when trying to add the loadedmeshes from the asset manager to an empty Babylon.Mesh instance. Here is the error I get:
Type 'import("babylonjs/Animations/animationGroup").AnimationGroup[]' is not assignable to type 'BABYLON.AnimationGroup[]'.
Type 'import("babylonjs/Animations/animationGroup").AnimationGroup' is not assignable to type 'BABYLON.AnimationGroup'.
Types have separate declarations of a private property '_scene'. [2322]
Argument of type 'import("babylonjs/Meshes/abstractMesh").AbstractMesh' is not assignable to parameter of type 'BABYLON.AbstractMesh'.
Types of property 'edgesRenderer' are incompatible.
Type 'import("babylonjs/Rendering/edgesRenderer").EdgesRenderer' is not assignable to type 'BABYLON.EdgesRenderer'.
Property '_source' is protected but type 'EdgesRenderer' is not a class derived from 'EdgesRenderer'. ts(2345)
No it was working fine until v15. This is a recent development after my update to v21. Hence the question. My current import is
import * as BABYLON from 'babylonjs';
Just pinging @bghgary to see if he may have an idea because this may have come after the commit to add loadedAnimationGroups to the meshassettask in the assets manager. Sorry if my guess is wrong here. Just trying to make a sense of this error. Happens when I do something like
this.player.PlayerAnimGroups = (task as BABYLON.MeshAssetTask).loadedAnimationGroups;
(task as BABYLON.MeshAssetTask).loadedMeshes.forEach((mesh)=>{
this.player.PlayerMesh.addChild(mesh);
}
The issue is definitely related to the move to modules.
I tried the following :
var task = new BABYLON.MeshAssetTask("", ββ, ββ, ββ);
var PlayerAnimGroups = (task as BABYLON.MeshAssetTask).loadedAnimationGroups;
(task as BABYLON.MeshAssetTask).loadedMeshes.forEach((mesh)=>{
sphere.addChild(mesh);
});
on alpha 21 and it compiles ok. The problem lies down in some typings conflicts and this would be hard to troubleshoot without knowing a bit more about your code. It definitely looks like some parts of the codes relies on the BABYLON (internal namespace typings) and other on the module typings resulting of the import.