简体   繁体   中英

point on a object in THREE.JS

I have loaded an .obj file. I would like to put a point on the brain, and that it does not change when the camera moves, that it is always at the same point as in this image.

在此处输入图片说明

var loader = new THREE.OBJLoader( manager );
        /* */
loader.load( 'freesurf.OBJ', function ( object ) {

 brain = object;
 object.position.y = 0;
 scene.add( object );

} );

https://plnkr.co/edit/iAr4Rl4Ohlq6bQIqdbJ6?p=preview

Here is solution base on SphereGeometry https://plnkr.co/edit/Y15PFd2Fietq5cjQLJjw?p=preview

I changed this part of code.

    var mat = new THREE.MeshBasicMaterial({color:'blue',transparent:true,opacity:0.5,

      depthFunc:THREE.LessDepth,side:THREE.FrontSide,})

      var sphr = new THREE.Mesh(new THREE.SphereGeometry(1,16,16),mat);
      sphr.position.set(1.3, 1.3, 0 );
      brain.add(sphr);


    } );

This is not perfect solution but working with approach of ball. To make this better you should play with pixel shader or create geometry base on the background object.

Project which can solve your problem is https://github.com/tomtung/chameleon.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM