what is weird is that often, most times it all works well. But sometimes when coming back, the camera rotation and controls just won’t work well, when I try to rotate, it will zoom instead, and very weird things will happen, and the only way to make things right again is to refresh the entire app
@PirateJC I would love to and I have already created a few playgrounds in questions I have posted and I do it whenever is possible. But in this case my react app has grown really large by now and its simply not possible to extract the real scenario I have with all its complexity. But anyway I will see if i can create a small simple playground just with the basic part that I am describing, I doubt though that the same behaviour will happen. I also understand that for you is very difficult to help me if i don’t have a playground for this specific case, I totally understand that, definitely (I guess i was just posting this question in case any of you had seen similar issues happening and maybe had some quick suggestion to try something but I get it that this it not the case)
Hey @javismiles I went through number of problems since I started using babylonjs last week. Event though it might seem impossible to reproduce, I would encourage you to try. Reproducing actual scenario in isolation might really help to identify the actual issue with the code.
It doesn’t have to be playground. I have started mocking babylon methods in my tests to make sure I am calling them as expected in strictly defined scenarios. It already helped few times not only to find the issue but also keeping me sane (as oppose to going through long list of console logs inspecting hundreds of properties ).
Good luck! …and please share if you find the problem.
@PirateJC@MarkBevels thank you both
yes I agree with all you said. In this specific case though, I am having a lot of issues to reproduce the situation, it happens quite randomly. As an engineer I am familiar with this kind of complex pseudorandom events, so hard to track but as soon as I manage to isolate in better ways when the issue happens I will definitely try to create a playground, thank you for all the feedback and support, this is truly a super helpful community
I’m not sure you need to attach/detach camera controls all the time. If you have really complex inputs on a specific camera, may be you should try a 2 cams approach… and then yes the PG with just the basics would certainly help (us and you) find the answer.
I am also not sure I understand
Do you mean you simply want to freeze the camera on scene when opening i.e. a settings panel. Or is it so that the user can choose a number of options for the camera behavior?
when user clicks button A, it will be able to draw on top of a model. For this I must stop camera autorotation, and also scene rotation with click and drag
that is the objective. Using two camera seems overkills to me (and not sure how to do it anyway, plus i just want to prevent the camera click behaviours so that user can draw on top of model, I dont want to change anything else regarding the camera). Attaching deattaching really works perfect. It’s just that sometimes i got those random weird things happening, but it happens pretty rarely i must say.
Just fixed a problem with my code where I was experiencing double “weird” behaviour. Started console logging to realise each time I save the file my console logs double on mouse press. It was related to unintended creation of additional subscriber on each webpack refresh which results in a race condition between handlers.
Instantly thought of your problem @javismiles. Probably not the case but thought of sharing above here in case you haven’t consider it.
Ive been testing more this issue because it keeps happening to me and pretty often. I have more info about it in case it suggests anything else.
Basically normally with an ArcRotateCamera like the one I have, clicking and dragging the mouse will rotate the view around the model.
When the problematic issue happens, suddenly clicking+dragging will zoom in and out of the scene, instead of rotating around the model, it will just zoom in and out, and the only way I find to reset it to the normal behaviour is to reload the entire app
These issues are definitely related to the use of:
which I need to use to stop temporarily this default behaviour of click+drag so that user can draw over the model using click+drag
I have tried to use an alternative by making use of:
camera.angularSensibilityX = Infinity;
camera.angularSensibilityY = Infinity;
which you suggested, but it seems to hurt performance
sorry I cannot create a playground because of the rest of complexity in the app, if this new description suggests any new clues let me know thank you
actually I found out that this problem that I have happens not only in the case I described above, sometimes it also happens right after I load a model, nothing related to what I described before, but the issue is the same,with the arcrotatecamera, in which the click+drag behaviour on laptop, instead of rotating around model, only zooms in and out, and the only way to solve it is to restart the whole thing; again I cannot identify an scenario to build a playground, but seeing this now happen in different places sounds like there is definitely something there… will report if i find anything else about it
is the click+drag behavior for zoom in-out one of your input for another camera or viewport, or you haven’t set anything alike? How many cameras/viewports do you have in the scene? I personally hate it when I bounce into this random type of error that may or may not occur. May be there are just multiple causes. Hope someone will be able to give us a light…
@mawa@JohnK thank you both, yes this is driving me a bit nuts as its my last issue to solve so mawa I only have 1 camera and only 1 scene and only 1 viewport
and John, what surprised me is that this zoom in-out instead of rotate behaviour of the arcrotatecamera has happened as well outside of the attach/unattach moment, very odd, and once it kicks in, once it happens once, there is no way to reset it unless I reload the whole thing;
thank you very much for creating that playground; if i see a possibility to build it towards my scenario I will do it but at the moment it doesn’t make sense as my app is just too large and complex to reduce it to a few lines,
Yeah, well GL. I’m just happy this one is not mine I suppose you tried a variety of browsers (not just Chrome). I suppose you tried simplify by removing *[pointers] and simply attach and detach controls to check if any different…
@mawa yeah, I tried a few things, will try more, by the way I am only interested in making this work in chrome and ios safari, dont care about the other browsers, so far only tested in chrome, will test safari as soon as I can, but in theory it should all be compatible between both right?
I guess at this point, you should check Safari or any other browser, just to make sure. I had some bad experiences with the updates of Google’s policy and sudden (or announced but disregarded;) changes in the handling of behaviors (and some other stuff too… I guess what you will want now is try eliminate 1 by 1 all the possible causes…
@mawa making new tests it seems clear that the problem is related to this
I have to try all the alternatives to those, I already tried the camera sensitivity to 1000 but that hurts performance, what other ways do i have to stop the click+drag rotation behaviour of the arcrotatecamera and reenable it later?