I‘m using superframe‘s orbit-controls (https://github.com/supermedium/superframe/tree/master/components/orbit-controls) and I have a scene with two entities that the user can toggle on/off with a button. Whenever the user clicks on the button, I‘d like to reset the camera position to its initial state.
I've tried resetting the camera's world position like I normally would without using the orbit controls, but so far I haven't had any luck. Here's a jsfiddle of the situation: https://jsfiddle.net/e7akdgf1/5/
<a-scene embedded class="box" vr-mode-ui="enabled: false" loading-screen="enabled: false">
<a-entity id="cam"
camera
orbit-controls="target: 0 0 0;
initialPosition: 0 0 5;
minDistance: 1;
maxDistance: 50;">
</a-entity>
<a-entity id="cube" position="0 0 0" rotation="45 30 0" geometry="primitive: box; height: 3; width: 3; depth: 3;" material="color: #167341; roughness: 1.0; metalness: 0.2;"></a-entity>
<a-cylinder id="cylinder" position="1 1.25 -1" radius="1" height="2.5" color="#FFC65D" visible="false"></a-cylinder>
</a-scene>
You can change the position like this
// check what setting the initial position does in the source code
cam.getObject3D('camera').position.set(0, 0, 5)
fiddle here.
this.el.components['orbit-controls'].controls.reset()
in the source code, but I had no luck with it.