javascript - Static Object in Scene - Three.js -
i have 2 objects in scene. using
 <script src="js/controls/leaptrackballcontrols.js"  ></script> for moving camera, feels objects rotating according movement of hand.
the problem other object moving, , want remain in front of me. mean, if camera moves, object in same place inside canvas/explorer.
sorry if i'm not explaining myself properly.
any appreciated.
edit:
var controls = new three.leaptrackballcontrols( camera , controller ); so, have sphere in middle of scene. use leaptrackball library move camera around center of scene. makes user feel sphere rotating around center.
model = new three.mesh(modelgeo, modelmat); model.geometry.dynamic = true; model.position.set(0, 0, 0); scene.add(model); my problem have shape:
mymesh = new three.mesh(circlegeometry, material); mymesh.position.set(0, 0, 10); scene.add(mymesh); that affected rotation of camera. want keep 'fake rotation' of sphere, while other mesh stays in middle of screen (0,0,10).
ok, camera object.
var camera = new three.perspectivecamera(55, window.innerwidth / window.innerheight, 0.1, 5000);
and render function, used update control/movement of camera.
   function render() {         controls.update();         renderer.render(scene, camera);         domouse();         if(useorbitcontrols){             orbitcontrols.update();         }     } i'm using leap controller, , function builds up:
function leapmotion() {                 var controlleroptions = {                     enablegestures: true                     , background: true             , frameeventname: 'animationframe'                 , };  [...]      controller.on('frame', onframe); basically, means onframe function done everytime receives frame (60 per second aprox.)
    function onframe(frame){ [...]         } there not more, magic comes library can find here:
if want object -- such crosshairs -- fixed in front of camera, can adding object child of camera. use pattern one:
scene.add( camera ); // required when camera has child camera.add( object ); object.position.set( 0, 0, - 100 ); // or whatever distance want three.js r.71
Comments
Post a Comment