Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8163423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:02:58+00:00 2026-06-06T19:02:58+00:00

What I am trying to achieve is to have two control modes, a free

  • 0

What I am trying to achieve is to have two control modes, a free “flying” one, and an object-centered one (trackball) and with a button press seamlessly switch between them.

I initially tried with TrackBallControls and FlyControls. The problem with those two, is that TrackballControls is based on Euler angles, while FlyControls is based on Quartenions. I tried converting the camera.rotation vector to a quaternion by doing,

quaternion.setFromEuler( target ); //where target, a Vector3 that contains degrees

And setting the position manually (since they use the same position object), and while it seemed to be working, rotating the camera a bit – and switching controls, started yielding horribly wrong results. Also, grabbing Euler angles from the quaternion (setEulerFromQuaternion) resulted in wrong data.

So, while I was able to switch between them, I was never able to sync their rotation coordinates, so “on switch” while the camera position is correct the rotation is wrong.

PS. I had some results with the FirstPersonControls (euler angles as well) but the screen lat,long method it is using is very error prone and fails completely when there is Z axis rotation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:03:01+00:00Added an answer on June 6, 2026 at 7:03 pm

    What about something like this?

    function onClick() {
    
        var prevCamera = camera;
    
        camera = new THREE.PerspectiveCamera(...);
        camera.position.copy( prevCamera.position );
        camera.rotation.copy( prevCamera.rotation );
    
        var MODE = { TRACKBALL: 0, FLY: 1 };
    
        switch( mode ) {
    
            case MODE.FLY:
    
                controls = new THREE.TrackballControls( camera );
    
                mode = MODE.TRACKBALL;
    
                break;
    
            case MODE.TRACKBALL:
    
                controls = new THREE.FlyControls( camera );
    
                mode = MODE.FLY;
    
                break;
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to achieve some thing one these lines ,I have two listboxes
What I'm trying to achieve here is lets say we have two example URLs:
Here's the jfiddle for what I'm trying to achieve: http://jsfiddle.net/fmvmA/ I have two issues
ok so this is what I am trying to achieve is to have two
I have two divs: div1 and div2 I am trying to achieve an effect
I have something I am trying to achieve. I have a web application running
I'm trying to achieve the following: I have a directory with multiple video files
im trying to achieve something but i dont really know how I have set
I am trying to achieve an LDAP query to gather all properties we have
What I'm trying to achieve is a scrollable tab-bar. I have a web page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.