Nikos123 Posted May 22, 2016 Share Posted May 22, 2016 In my RTS game I want to allow user to drag select units. How can I stop camera rotation when on mouse drag? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 22, 2016 Share Posted May 22, 2016 Hello, you can just call camera.detachControl(canvas) to stop camera rotation Quote Link to comment Share on other sites More sharing options...
dbawel Posted May 22, 2016 Share Posted May 22, 2016 @Deltakosh - camera.detachControl(canvas) definately stops camera rotation when moving the pointer, however, I'm having issues with browsers on Ipad. I've detached camera control, but as the resolution is so very different over the various display resolutions on Ipad the past 2 years, the browser often scrolls when I need the pointer to draw on screen. And I cannot limit my app to a specific resolution - or at least prefer not to. I can certainly identify the OS and that the device is an IPad, However, my preference is not to do so since it is ONLY the IPad which I have this issue. Has anyone else solved the crappy IPad pointer performance issues on various IPad devices depending on resolution? Android is much "smarter " when it comes to handling various browsers - especially Chrome. DB Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 23, 2016 Share Posted May 23, 2016 You can prevent the scrolling by capturing the mouse event and stopping propagation with evt.preventDefault() Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 23, 2016 Share Posted May 23, 2016 And here is an example of detach/attachControl: http://www.babylonjs-playground.com/?18 dbawel 1 Quote Link to comment Share on other sites More sharing options...
dbawel Posted May 23, 2016 Share Posted May 23, 2016 @Deltakosh- Thank you so very much. This is EXACTLY what I needed. I can't begin to tell you how valuable this example is to me - and I hope to other developers on the forum who are still cutting their teeth in JavaScript as I am - especially those who need to support as many mobile devices as possible. I'll still be registering the OS and setting case(s) for mesh properties dependant in each OS, however the method you provided in the playground scene above will help me to optimize many functions dramatically. I hope you had a great weekend, and your Wife and family are well. And of course, have a great week! Cheers, DB GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Nikos123 Posted June 16, 2016 Author Share Posted June 16, 2016 thanks guys, I feel asleep! Quote Link to comment Share on other sites More sharing options...
Nikos123 Posted June 16, 2016 Author Share Posted June 16, 2016 My game will just be targeting desktop, can't imagine supporting ipad also. Quote Link to comment Share on other sites More sharing options...
Nikos123 Posted June 16, 2016 Author Share Posted June 16, 2016 My game will just be targeting desktop, can't imagine supporting ipad also. One other thing I plan to do. i will lock the mouse to the canvas and when the user touches the edges, the camera will pan in that direction (like a normal RTS game) Quote Link to comment Share on other sites More sharing options...
sjain38 Posted August 18, 2020 Share Posted August 18, 2020 Thank you I have same problem. But I am working in React app, I am using <arcRotateCamera /> to make camera. How I can detach control in react app? Quote Link to comment Share on other sites More sharing options...
darel aranovski Posted March 11, 2021 Share Posted March 11, 2021 Thank you) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.