I keep getting this error in browser and i’m so drained and lost:
TypeError: this._physicsEngine.removeImpostor is not a function
at _PhysicsImpostor._init (chunk-DQNGVYKG.js?v=dde2dffd:27786:25)
at new _PhysicsImpostor (chunk-DQNGVYKG.js?v=dde2dffd:27769:14)
at createScene (index.ts:33:28)
And this is what i have in my index.ts
import {
Engine,
Scene,
Vector3,
PhysicsImpostor,
MeshBuilder,
UniversalCamera,
} from "@babylonjs/core";
import { HavokPlugin } from "@babylonjs/core/Physics/v2/Plugins/havokPlugin";
import "@babylonjs/loaders/glTF/2.0";
import "@babylonjs/core/Helpers/sceneHelpers";
import HavokPhysics from "@babylonjs/havok";
async function createScene() {
// Create the engine and scene
const canvas = document.getElementById(
"renderCanvas"
) as HTMLCanvasElement | null;
const engine = new Engine(canvas, true);
const scene = new Scene(engine);
// Initialize Havok Physics
const havok = await HavokPhysics();
const plugin = new HavokPlugin(undefined, havok);
scene.enablePhysics(new Vector3(0, -9.81, 0), plugin);
// Create a ground plane
const ground = MeshBuilder.CreatePlane(
"ground",
{ width: 10, height: 10 },
scene
);
ground.physicsImpostor = new PhysicsImpostor(
ground,
PhysicsImpostor.BoxImpostor,
{ mass: 0 },
scene
);
// Create a box
const box = MeshBuilder.CreateBox(
"box",
{ width: 1, height: 1, depth: 1 },
scene
);
box.position.y = 2;
box.physicsImpostor = new PhysicsImpostor(
box,
PhysicsImpostor.BoxImpostor,
{ mass: 1 },
scene
);
// Create a camera
const camera = new UniversalCamera(
"camera",
new Vector3(0, 5, -10),
scene
);
camera.setTarget(Vector3.Zero());
scene.activeCamera = camera;
// Start the render loop
engine.runRenderLoop(() => {
scene.render();
});
}
createScene();
Please help a drowning soul