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 9249499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:12:22+00:00 2026-06-18T10:12:22+00:00

When I drag the mouse left or right, i’d like drag the scene, don’t

  • 0

When I drag the mouse left or right, i’d like drag the scene, don’t rotate camera.

I tried

camera.position.x = mouseX;  
camera.position.y = mouseY;  

but scene rotated

I tried change position in scene — scene rotated.

How to drag the scene?

  • 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-18T10:12:24+00:00Added an answer on June 18, 2026 at 10:12 am

    here is a file i got at github that might work

     THREE.DragControls = function(_camera, _objects, _domElement) {
    
     if (_objects instanceof THREE.Scene) {
    
    _objects = _objects.children;
    
     }
    
     var _projector = new THREE.Projector();
    
     var _mouse = new THREE.Vector3(),
    
        _offset = new THREE.Vector3();
    
    var _selected;
    
    _domElement.addEventListener('mousemove', onDocumentMouseMove, false);
    
    _domElement.addEventListener('mousedown', onDocumentMouseDown, false);
    
    _domElement.addEventListener('mouseup', onDocumentMouseUp, false);
    
    
    function onDocumentMouseMove(event) {
    
      event.preventDefault();
    
       _mouse.x = (event.clientX / _domElement.width) * 2 - 1;
    
       _mouse.y = -(event.clientY / _domElement.height) * 2 + 1;
    
        var ray = _projector.pickingRay(_mouse, _camera);
    
        if (_selected) {
    
             var targetPos = ray.direction.clone().multiplyScalar(_selected.distance).addSelf(ray.origin);
    
             _selected.object.position.copy(targetPos.subSelf(_offset));
    
            return;
    
       }
    
    
        var intersects = ray.intersectObjects(_objects);
    
        if (intersects.length > 0) {
    
           _domElement.style.cursor = 'pointer';
    
        } else {
    
            _domElement.style.cursor = 'auto';
    
        }
    
      }
    
       function onDocumentMouseDown(event) {
    
         event.preventDefault();
    
         _mouse.x = (event.clientX / _domElement.width) * 2 - 1;
    
         _mouse.y = -(event.clientY / _domElement.height) * 2 + 1;
    
         var ray = _projector.pickingRay(_mouse, _camera);
    
         var intersects = ray.intersectObjects(_objects);
    
         if (intersects.length > 0) {
    
             _selected = intersects[0];
    
             _offset.copy(_selected.point).subSelf(_selected.object.position);
    
             _domElement.style.cursor = 'move';
       }        
      }
    
    
      function onDocumentMouseUp(event) {
    
         event.preventDefault();
    
         if (_selected) {
    
             _selected = null;
    
        }
    
         _domElement.style.cursor = 'auto';
    
     }
    
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to do Drag & Drop with the right mouse button instead with
How do I capture a left mouse click , up/down/drag? What would the right
Does anyone know how to get the correct mouse position during a drag-and-drop operation
I would like to use the middle mouse button to drag an image in
When I left-click and drag the mouse, IE9 doesn't recognize the mousemove event. I
I wrote an application where you can drag left and right some timeline. When
In VS 2010 when you drag one control to your page (left mouse button
see fiddle I want to drag the mouse on cell and whatever is under
Is there a way to use a mouse click and drag in wpf? I
I am trying to handle a drag & drop interaction, which involves mouse down,

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.