We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

set domElement of orbit controls

Home Forums Programming set domElement of orbit controls

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #29278
    thomasup
    Customer

    we are using html divs anchored to 3d objects, so that the divs float above (and move with) the rendered 3d model. similar to the scooter example application, but with html elements rather than 3d discs.

    but, unfortunately, this means they block mouse drag events (for rotation) when the drag is started inside a overlay div.

    in pure threejs, our approach would be to pass a domElement to the orbit controls in the constructor.

    is this also possible within the verge3d “app” structure? because, as far as we understand, the v3d “app” is initializing the orbit controls, so are there parameters we can pass / influence to what domElement the events are linked?

    #29710

    Hi,

    You can use the App.enableControls method. It receives an HTMLElement as a parameter and passes it into the OrbitControls constructor. You can do that after the app is loaded, for example in the standard runCode function:

    
    function runCode(app) {
        // add your code here, e.g. console.log('Hello, World!');
        app.enableControls(document.getElementById('v3d-container'));
    }
    

    Co-founder and lead developer at Soft8Soft.

    #29738
    thomasup
    Customer

    that works perfectly for us!

    thanks :good:

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.