Hello everyone!
I have an issue with OrbitControl and i am not sure what’s the problem.
I have a little scene where i am using raycaster to select object, after selection i want my camera target to be updated
if you take a look at my example here - > https://cadcamge.ch/st/irakli/project/#
select object then click drone button and use Circle button and then play button. you will see that object is centrilised and everything works fine but if you choose helix button after selection object is not centrilised i dont know why i am using target.set( object.position ) and after that update but it doesnot work can anyone help me please?
Here is my code :
if( !geo_chosen ){
controlsLoader.control1.target.set( 0,0,0 );
controlsLoader.control2.target.set( 0,0,0 );
}
// if object is selected then camera target will be object
if( geo_chosen ){
controlsLoader.control1.target.set( intersected_geo.position.x,
intersected_geo.position.y, intersected_geo.position.z );
controlsLoader.control2.target.set( intersected_geo.position.x,
intersected_geo.position.y, intersected_geo.position.z );
}
controlsLoader.control1.enabled = false;
controlsLoader.control2.enabled = false;
camera.position.x = (sphericalRadiusNow-scope.radius)*Math.cos( scope.alpha );
camera2.position.x = (sphericalRadiusNow-scope.radius)*Math.cos( scope.alpha );
camera.position.z = (sphericalRadiusNow-scope.radius)*Math.sin( scope.alpha );
camera2.position.z = (sphericalRadiusNow-scope.radius)*Math.sin( scope.alpha );
scope.radius += maxRadius/1000;
scope.alpha += 0.01;
controlsLoader.control1.update();
controlsLoader.control2.update();
Thank you for reading this and i hope someone will help me! Thank you.