Trying to load a mesh

Excuse how much of a new guy I am and such a basic question, but I’m trying to load a mesh locally (run it in Chrome off my desktop) I now understand that’s not supported so I uploaded it to a webserver but still getting the same output, ‘nothing’

	BABYLON.SceneLoader.ImportMesh("chair", "assets/", "chair.obj", scene, function(object) {
	object.scaling = new BABYLON.Vector3(1,1,1);
	object.position = BABYLON.Vector3.Zero();

Could I get some help in this area, JS is not my strongest language.
Full code:

    <!DOCTYPE html>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8"/>
    <title>Babylon - Getting Started</title>
    <!--- Link to the last version of BabylonJS --->
    <script src=""></script>
	<script src=""></script>
	<script src="babylon.js"></script>
	<script src="babylon.objFileLoader.js"></script>
	<script src=""></script>
	<script src=""></script>
        html, body {
            overflow: hidden;
            width   : 100%;
            height  : 100%;
            margin  : 0;
            padding : 0;

        #renderCanvas {
            width   : 100%;
            height  : 100%;
            touch-action: none;
    <canvas id="renderCanvas"></canvas>
        window.addEventListener('DOMContentLoaded', function(){
            // get the canvas DOM element
            var canvas = document.getElementById('renderCanvas');

            // load the 3D engine
            var engine = new BABYLON.Engine(canvas, true);

            // createScene function that creates and return the scene
var createScene = function () {
 var scene = new BABYLON.Scene(engine);

    //Adding a light
    var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 20, 100), scene);

    //Adding an Arc Rotate Camera
    var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0.8, 100, BABYLON.Vector3.Zero(), scene);
    camera.attachControl(canvas, false);

    var assetsManager = new BABYLON.AssetsManager(scene);
	var meshTask = assetsManager.addMeshTask("chair", "assets/", "", "chair.obj");
	meshTask.onSuccess = function (task) {
	    task.loadedMeshes[0].position = BABYLON.Vector3.Zero();

    // Move the light with the camera
    scene.registerBeforeRender(function () {
        light.position = camera.position;
	assetsManager.onFinish = function (tasks) {
		engine.runRenderLoop(function () {

    return scene;

            // call the createScene function
            var scene = createScene();

            // run the render loop

            // the canvas/window resize event handler
            window.addEventListener('resize', function(){

Hello and welcome :slight_smile:
Can you make sure that your server is configured to serve .obj files?

Also make sure to use the same version of both babylon and the loaders:

<script src=""></script>
<script src=""></script>
1 Like

Does deleting your MTL file help?

If so restore it and then post the top lines of it for me, Ill show you the line that is breaking it.

I have a sneaking suspicion here (I’ve had this happen before).

If deleting your MTL then clearing your cache does not fix it. Ignore what I have just said.

Are you getting any 404 errors?

1 Like

Thanks guys I figured it out, I just had to run a local server on my machine to allow it to run. :confused: