Temechon Posted May 22, 2015 Share Posted May 22, 2015 Hey guys, I noticed something strange for an arc rotate camera: when there is no upperBetalimit (set to null) and no lowerBetaLimlit (set to null too), the camera doesn't go all way around, but switch on one side of the target.Playground : http://www.babylonjs-playground.com/#9U5IW That's because the arcrotatecamera handle its position with sin/cos of alpha/beta (thus between -1 and 1). In one of my project, this is a no-go :/ I need a camera going all way around the target. Could it be possible to build an ArcRotateCamera with quaternion ? If yes, could you give me some pointer on how to do it ? Thanks Ahiru 1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted May 22, 2015 Share Posted May 22, 2015 Oh, that's a nice task :-) With the current ArcRotateCamera it will not be possible due to the sin(beta) calculation, exactly like you mentioned.I think (not too sure thou) that a quaternion will not be the thing that will solve this. I believe a different approach is needed.Right now, moving the mouse on the x and y axis only adds/decreases from the beta/alpha value. those values are used to calculate the new position. What I think would solve this is to use the camera's current direction and calculate the next step accordingly. Move your mouse left and right, after you rotated up 90 degrees, and you will understand what I mean - It no longer rotates left and right, it turns clockwise or counter clockwise. What I am suggesting will prevent that. Moving the mouse left will always move the camera to the left. same goes to up down and right :-)Now, I don't know if this is possilble and how easy it is to implement, I however believe that the answers are:1) it is possible2) it is not that simple... i'll give it a try when I have the time, I like those kind of challenges :-) Temechon 1 Quote Link to comment Share on other sites More sharing options...
dbawel Posted May 22, 2015 Share Posted May 22, 2015 You shouldn't need t use quaternions for cameras if you use the camera interset to aim your camera. Am I wrong? Quote Link to comment Share on other sites More sharing options...
RaananW Posted June 3, 2015 Share Posted June 3, 2015 hey Julian,something like this? - http://www.babylonjs-playground.com/#LEASDHope it helps. It is not the prettiest hack, but it is an infinite ArcRotate. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted June 3, 2015 Share Posted June 3, 2015 We want it in 2.2 ! Quote Link to comment Share on other sites More sharing options...
Temechon Posted June 3, 2015 Author Share Posted June 3, 2015 Nice work Raanan ! The only flaw I can see is when the camera upside down, rotating to the left will make the camera go to the right. I worked on it last week, and i used a freecamera, an hidden target and quaternion, like this : http://www.babylonjs-playground.com/#YRIPX#1Did the work for me. Thank you very much though ! Wingnut and Ahiru 2 Quote Link to comment Share on other sites More sharing options...
RaananW Posted June 3, 2015 Share Posted June 3, 2015 A simple hack : http://www.babylonjs-playground.com/#LEASD#1But i like your so much better :-) nice work!! Temechon 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 3, 2015 Share Posted June 3, 2015 Can you PR it Ranaan? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 3, 2015 Share Posted June 3, 2015 Nevermind I did it Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted June 4, 2015 Share Posted June 4, 2015 This version A simple hack : http://www.babylonjs-playground.com/#LEASD#1But i like your so much better :-) nice work!! Hmm, for us (as devs) that's a pretty nice trick to change orientation of cam rotation when above objects, but by experience I know that people will be fooled by this and cannot be able to manipulate the orbital camera without having the feeling of "something goes wrong". Try to rotate a lot in every position possible and you'll see that sometimes the rotation suddenly stops to go opposite way, in my opinion that's not applicable for production.Nevertheless, your first attempt is just perfect, and we should implent this one in BJS :http://www.babylonjs-playground.com/#LEASD For people who need an orbital acting like the Temechon attempts with Free camera, well, they can use that attempt as a start point (@Alby, that could be listed in centralisation of user functions) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 4, 2015 Share Posted June 4, 2015 this is now enabled under a flag: camera.allowUpsideDown (on by default) 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.