Rotating object instead of camera with DeviceOrientationControls

点点圈 提交于 2019-12-11 19:39:09

问题


So I am using DeviceOrientationControls from THREE.js to rotate the object around in VR, similar to how google cardboards app does in the exhibit experience. I have partially succeeded in doing this by replacing "camera" in THREE.DeviceOrientationControls(camera) with "scene". However, the scene also contains edges around the cube with the help EdgesHelper.

var edges = new THREE.EdgesHelper(mesh, 0x000000);

What happens is the Edges are seperate from the rest of the object, so when I use it in VR, the object moves like it should, but the edges(outline) of the object move differently. Any help with resolving this?


回答1:


You can implement an "EdgesHelper" yourself like so:

var geometry = new THREE.EdgesGeometry( mesh.geometry );
var material = new THREE.LineBasicMaterial( { color: 0xffff00, linewidth: 2 } );
var edges = new THREE.LineSegments( geometry, material );
mesh.add( edges );

three.js r.73



来源:https://stackoverflow.com/questions/33815662/rotating-object-instead-of-camera-with-deviceorientationcontrols

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!