Fur Material Can't Recognize Scene Instance

Hey,

I’m trying to add grass to the ground using FurMaterial and I’m receiving the following error message when I try to instantiate a new FurMaterial.

“Argument of type 'import(”…/node_modules/@babylonjs/core/scene").Scene’ is not assignable to parameter of ‘import("…/node_modules/@babylonjs/materials/node_modules/@babylonjs/core/scene").Scene’. Types of property ‘_inputManager’ are incompatible.\n. Type ‘import("…/node_modules/@babylonjs/core/Inputs/scene.inputManager").InputManager’ is not assignable to type ‘import("…/node_modules/@babylonjs/materials/node_modules/@babylonjs/core/Inputs/scene.inputManager").InputManager’. Types have separate declarations of a private property ‘_wheelEventName’.",

I have a singleton class that instantiates my scene that comes from “/node_modules/@babylonjs/core/scene” and not from “/node_modules/@babylonjs/materials/node_modules/@babylonjs/core/scene”.

Here is my class that creates the grass:
import { GrassProperties } from “…/properties/GrassProperties”;
import { Vector3 } from “@babylonjs/core/Maths/math”;
import { Mesh } from “@babylonjs/core/Meshes/mesh”;
import { SceneInstance } from “…/…/utils/SceneInstance”
import { FurMaterial } from “@babylonjs/materials/fur/furMaterial”;

export class GrassMesh {

private static furMaterialName: string = "furMaterial";

public static draw(grass: GrassProperties, width: number, height: number, position: Vector3): Mesh {
    const groundGrass = Mesh.CreateGround(grass.name, width, height, grass.subdivides, SceneInstance.scene, true)
    groundGrass.position = position;
    groundGrass.receiveShadows = true;
    
    const furMaterial = new FurMaterial(this.furMaterialName, SceneInstance.scene); <---- here is the line with error
    furMaterial.highLevelFur = grass.highLevelFur;
    furMaterial.furLength = grass.furLength;
    furMaterial.furColor = grass.furColor
    groundGrass.material = furMaterial;

    return groundGrass;
}

}

What do you think it’s the problem? It worked before migrating to Babylon4.

Invoking our emperor of Imports @sebavan

1 Like

Looks like a weird version mismatch ???

Could you delete your nodes_modules folder and npm i again ? also could you check in package.json that the version are consistents for @babylonjs related packages ?

1 Like

Thank you!
It’s working now.

My @babylonjs/core was 4.0.3 and my @babylonjs/materials was 4.0.2.
I corrected them and now both of them are 4.0.3 and I’ve followed your instruction to delete the nodes_modules and run npm i again.

1 Like