Issue with orbit control

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.

Forgot to add after IF statements i have a function that uses animation Frame so on each frame scene should be updated and camera must rotate around object

also : sphericalRadiusNow is Fixed distance between target and camera

  1. Fyi, that link directs to 2 separate SSL warnings that, even after ignoring them, lead to a 404 page.

  2. I can’t tell what the issue is, since demo is not working, but maybe this example can help you a bit? It does show target selection and transitions.

1 Like

About 1 part i didnt know that i had any warnings, i am testing it on chrome so it works fine idk.
about 2 : the problem is that when i select an object i want it to be centriliesd and when i choose helix button i want it to fly around the object but it doesnt moving around the object.

After you accept SSL warning once it does not show explicitly, though you can still see that there’s a badge “Not Secure” next to the url:

Regardless security, there’s a 404 and no demo to preview. :’)

1 Like

Ohh thanks for update. I guess my boss server is down :smiley:

Is it possible to upload big project on codepen ?