3d help with importing assets
So, using babylon.js and javascript: obviously the loader callback is wrong, but my poor brain just won't wrap around this. How do I import the asset .OBJ and put it in the scene? Help please.
scene = new BABYLON.Scene()
light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, 0), scene)
camera = new BABYLON.FreeCamera("camera", new BABYLON.Vector3(0, 0, -100), scene)
init = function() {
x = 0 ;
y = 0 ;
box = BABYLON.MeshBuilder.CreateBox("box", {size:10}, scene)
box.position.set(0,20,0)
loader = asset_manager.loadModel("1st",foo)
}
foo = function(o){
o.addAllToScene();
}
update = function() {
if (keyboard.LEFT) { x = x-1 ; }
if (keyboard.RIGHT) { x = x+1 ; }
if (keyboard.UP) { y = y+1 ; }
if (keyboard.DOWN) { y = y-1 ; }
camera.position.x=x;
camera.position.y=y;
}
draw = function() {
screen.render(scene)
}