简体   繁体   中英

Three.js - Disable 3d object translations along x, y and z axis

I am trying to disable the movement of a 3D model along the x, y and z axis. I would like to allow the user to rotate and zoom, but I suspect that moving it can only cause issues. I have found something to disable rotation, but no similar thing for translation.

Possible Usability Issues:

  1. The rotation point shifts when translating along the axis, this will cause the rotation behaviour to be all messed up.
  2. They could move the object outside of their window. I could set boundries, but what is the real use of a 3D model viewer if the user is just going to loose the object on accident.

In short: I would perfer to disable the feature to prevent possible usability issues.

I hope someone can tell me how to achieve this.

You can disable panning with OrbitControls like so:

controls = new THREE.OrbitControls( camera, renderer.domElement );
controls.enablePan = false;

See the source code for other options.

three.js r.92

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