Jump to content

camera.detachControl


Dad72
 Share

Recommended Posts

Hello,

When the mouse is released following the event "pointerup", the camera is attached to the pointer of mouse.

Seems to be related to changes added by Camera.ForceAttachControlToAlwaysPreventDefault() (I suppose). The camera.detachControl() is not working as expected now.

Thanks

Link to comment
Share on other sites

essaye de cliquer sur un cube et de le déplacer puis relâcher la souris et de déplacer la souris et un cube a nouveau.

ou essaye de cliquer sur run, j'ai eu cette erreur après. (elle semble aléatoire celle la)

Link to comment
Share on other sites

I do not know if this was correct but if I add a camera.attachControl(canvas, true); I error :

Cannot read property 'addEventListener' of undefined

http://www.babylonjs-playground.com/#1PZRYL

else if comment  //camera.attachControl, I error:

Cannot read property 'dispose' of undefined

If we click on Run 2 times, same thing was a mistake with 'dispose'

http://www.babylonjs-playground.com/#1PZRYL#1

I use Google Chrome

Link to comment
Share on other sites

J'ai vider les caches (3 fois pour être sûr) et si je clique 2 fois sur Run. l'erreur "dispose" est présent avec Chrome. avec Firefox en cliquand sur Run j'ai this._gamepads is undefined

et avec ce lien, sur Chrome j'ai l'erreur addEventListener  (les caches sont aussi re-vider): http://www.babylonjs-playground.com/#1PZRYL#2  (avant les 2 liens du dessus arrivait sur #1PZRYL#1). avec Firefox j'ai e is undefined

Et sur ce lien:  http://www.babylonjs-playground.com/#1UIC0D#0  l'erreur est toujours présente et n'exister pas avec les versions précédente d'y a 4 jours, donc l'erreur n'est pas avec EditorControl puisque ca fonctionner parfaitement bien avant. Si on regarde cette démo, cela fonctionne avec la versions précédente de Babylon: http://ssatguru.appspot.com/babylonjs/EditControl/webapp/index.html

Je pense qu'il y a vraiment un souci Deltakosh, je l'invente pas. je ne pense pas que c’est une question de cache. :) 

 

 

 

Link to comment
Share on other sites

OK I missed some bugs here:)

http://www.babylonjs-playground.com/#1PZRYL#2 :

* this._gamepads is undefined: Fixed! It was an issue introduced by the new input mechanism

* addEventListener  error: It was because the canvas was defined AFTER the call to attachControl. Here is a simple fix: http://www.babylonjs-playground.com/#1WZES2#0

 

For  http://www.babylonjs-playground.com/#1UIC0D#0 , I cannot help without a simpler PG. I cannot debug through all the code at the top of the PG

Link to comment
Share on other sites

I managed to reproduce the bug DK. That this produce with the use of a freeCamera.

Try to move an object and releasing the mouse, then the camera bug. It does not seem to detach or attach it correctly. She follows the mouse cursor. one is forced to click a second time on the scene so it works as expected.

http://www.babylonjs-playground.com/#1V64LL#0

Link to comment
Share on other sites

  • 1 year later...

I seem to have this same issue on the alpha preview builds.

But do not experience the issue on 3.0 stable.

 return t.prototype.attachControl = function(t, i) {
            var r, n, o, s = this, a = this.camera.getEngine(), l = 0;
            this._pointerInput = function(a, h) {
                var c = a.event;
                if (a.type === e.PointerEventTypes.POINTERMOVE || -1 !== s.buttons.indexOf(c.button))
                    if (a.type === e.PointerEventTypes.POINTERDOWN) {
                        try {
                            c.srcElement.setPointerCapture(c.pointerId)
                        } catch (e) {}
                        s._isPanClick = c.button === s.camera._panningMouseButton,

I am receiving :

TypeError: Cannot read property 'getEngine' of null

on the this.camera.getEngine() call

 

It is when I detach the camera on pointerDown, then attach it on pointerUp

I am sticking with 3.0 stable for now.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...