javascript - Three.js - Wrong Bounding Box importing Blender JSON model -


i having problems manipulating objects load blender. think pivot point set 0,0,0 instead of current object's position. correctly position , import objects in blender scene, have problems rotating them.

i have used boundingboxhelper see happening, bounding box not appearing surrounding object centered in world , 1-unit size (i guess default)

this code use load alien:

texture6 = three.imageutils.loadtexture('images/alien1.png', {}, function() {         renderer.render(scene, camera);     });      loader = new three.jsonloader();     loader.load( "models/alien1.js", function( geometry ) {         geometry.computefacenormals();         geometry.computecentroids();         geometry.computeboundingbox();          var mat = new three.meshbasicmaterial({map: texture6,transparent: true, color:0x00ff00} );         var mesh = new three.mesh( geometry, mat );         scene.add(mesh);          bbhelper = new three.boundingboxhelper( mesh, 0xff0000 );         scene.add( bbhelper );     }); 

and result: (the red bounding box should surrounding green alien in center of scene)

enter image description here

any suggestions?

you need call bbhelper.update().

make call in render loop if object moving.

three.js r.59


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -