So in the game I am currently working on I am trying to import an obj file has a certain house in it. I go the house to appear. Now I am trying to get it to go to where I want it. This is the error that is it giving me.
TypeError: scene.getMeshById is not a function at createGameScene (/gameScene.js:60:24) at start (/main.js:14:15)
and this is my code
`let createGameScene = function (canvas, engine) {
// Create scene
let scene = new BABYLON.Scene(engine);
scene.gravity = new BABYLON.Vector3(0, -.1, 0);
scene.enablePhysics(scene.gravity, new BABYLON.CannonJSPlugin());
// Create camera
let camera = new BABYLON.UniversalCamera(“Camera”, new BABYLON.Vector3(2, 2, 2), scene);
camera.attachControl(canvas, true);
camera.setTarget(BABYLON.Vector3.Zero());
// 87 corresponds to ‘w’
// 83 corresponds to ‘s’
// 65 corresponds to ‘a’
// 68 corresponds to ‘d’
// See more JavaScript KeyCodes here: https://keycode.info/
camera.keysUp.push(87);
camera.keysDown.push(83);
camera.keysLeft.push(65);
camera.keysRight.push(68);
camera.speed = 9;
camera.fov = 0.8;
camera.inertia = 0;
// create an ellipsoid around the camera (this will collide with other objects, such as the sphere
. This makes it so we can’t walk inside of the sphere)
camera.ellipsoid = new BABYLON.Vector3(3, 2, 2);
camera.checkCollisions = true;
camera.applyGravity = false;
camera.collisionsEnabled = true;
// Create lights
let light = new BABYLON.HemisphericLight(“myLight”, new BABYLON.Vector3(1, 1, 0), scene);
var ground = BABYLON.Mesh.CreateGroundFromHeightMap(“ground”, “./map.png”, 900, 900, 600, -10, 90, scene, false, (mesh) => { return; })
ground.checkCollisions = true;
ground.collisionsEnabled = true;
// Create a material with our land texture.
var groundMaterial = new BABYLON.StandardMaterial(“ground”, scene);
groundMaterial.diffuseTexture = new BABYLON.Texture(“grass.jpg”, scene);
ground.material = groundMaterial;
ground.position.y = -40;
const groundGrav = BABYLON.PhysicsImpostor.HeightmapImpostor;
let plane = BABYLON.MeshBuilder.CreateBox(“water”, {
height: 900,
width: 900
}, scene)
plane.rotate(BABYLON.Axis.X, Math.PI / 2, BABYLON.Space.WORLD);
plane.applyGravity = true;
var waterMaterial = new BABYLON.StandardMaterial(“water”, scene);
waterMaterial.diffuseTexture = new BABYLON.Texture(“waterbump.png”, scene);
plane.material = waterMaterial;
plane.position.y = -20;
BABYLON.SceneLoader.ImportMesh("", “https://dl.dropbox.com/s/dg7ut7uhajkiwxa/”, “villageHouseOne.obj”,scene);
let houseOne = scene.getMeshById(‘obj’);
houseOne.position.x = 34;
return scene;
};
export {
createGameScene
};`
Can someone that knows what their doing please help me.