In my current scene, I have two objects at play. Utilizing the LeapTrackballControls library for camera movement creates a dynamic where one object appears to rotate based on hand movements.
However, an issue arises as the second object also moves along with the camera motion. My goal is to keep this second object stationary in front of me, regardless of camera movement within the canvas/explorer.
Your understanding and assistance with this matter would be greatly appreciated.
EDIT:
var controls = new THREE.LeapTrackballControls( camera , controller );
The setup involves a central sphere that users interact with using LeapTrackball library, giving the perception of rotation around their center.
model = new THREE.Mesh(modelGeo, modelMat);
model.geometry.dynamic = true;
model.position.set(0, 0, 0);
scene.add(model);
The challenge lies with another shape:
myMesh = new THREE.Mesh(circleGeometry, material);
myMesh.position.set(0, 0, 10);
scene.add(myMesh);
This additional object seems to mimic the camera's rotation. The objective is to maintain the spherical rotation effect while keeping the other mesh fixed in the center of the screen (coordinates: 0,0,10).
Details regarding my camera object:
var camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 0.1, 5000);
Below is the render function responsible for updating camera control/movement:
function render() {
controls.update();
renderer.render(scene, camera);
doMouse();
if(useOrbitControls){
orbitControls.update();
}
}
With the integration of a Leap controller, here is the function building it up:
function leapMotion() {
var controllerOptions = {
enableGestures: true
, background: true
, frameEventName: 'animationFrame'
, };
[...]
controller.on('frame', onFrame);
Essentially, the 'onFrame' function executes with each received frame (approximately 60 times per second).
function onFrame(frame){
[...]
}
The functionality largely stems from the library accessible at: