Dark
Dark

Reputation: 333

Rotating object instead of camera with DeviceOrientationControls

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?

Upvotes: 0

Views: 254

Answers (1)

WestLangley
WestLangley

Reputation: 104843

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

Upvotes: 2

Related Questions