jschwuch Posted January 3, 2017 Share Posted January 3, 2017 Hi, I already replied to @faljses post in bugs section (link below) but I'm not sure this really is a bug so I'll try and ask here too if anyone knows a way to do this. So, I'm trying to use picking with an orthographic camera. My picking code works as long as I use a camera in mode=0 but in orthographic mode it never hits anything. Here is faljses playground example that shows that as soon as you change the camera mode to 1, the picking stops working. http://www.babylonjs-playground.com/#XUDHE I already searched the source for some hours by now to see if I can spot a bug but didn't find one. I suspect that what ever goes wrong (bug or me using the framework wrong) has to do with the cameras projection matrix. In my own code I use Scene.pick to get my picking information but I suspect, that the problem I experience is the same as the one we see in the Playground, thus I'd like to focus on the Playground first for convenience. I appreciate any hints I can get, as I need to get this working, so if you have an idea what might go wrong here please tell me. faljses post in Bugs section: Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted January 3, 2017 Share Posted January 3, 2017 Are your ratios setup correctly for the ortho projection? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 3, 2017 Share Posted January 3, 2017 I think I can narrow this down as probably not a bug. I have a scene where I switch between ortho and perspective (using the 'Use System Camera' checkbox). All buttons here are meshes. I am using 2 different cameras, but that shouldn't matter. Does make it a little complicated to see what is happening. Looked at your pg. Even commenting out the othro mode set stuff does not fix, so I think you may be trying to solve the wrong problem. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 3, 2017 Share Posted January 3, 2017 One thing though. I am using 2.5. I really which there was a way to use the production BJS to rule out framework development problems. Quote Link to comment Share on other sites More sharing options...
jschwuch Posted January 4, 2017 Author Share Posted January 4, 2017 Thanks for your answers! @Pryme8 are there "correct" ratios? I think the picking should work with any ratios. But if it doesn't: Is all I have to take care of, that the aspect doesn't change? I have one camera in my scene that has correct ratios and one that doesn't and am currently testing with the one that doesn't, maybe I should test with the one with "correct" ratios first... @JCPalmer thank you for your scene, it looks like this is exactly what I'm searching, I'll take it apart and see what I did wrong About my PG: When I comment out the line freeCamera.mode = BABYLON.Camera.ORTHOGRAPHIC_CAMERA; picking works so it is a problem with ortho mode, maybe @Pryme8 is right and it's the ratios. Quote Link to comment Share on other sites More sharing options...
jschwuch Posted January 4, 2017 Author Share Posted January 4, 2017 Got it working! @Pryme8 Was right, kind of. I actually messed up with rotations and "fixed" it by setting the "ortho parameters" to negative values, which caused my camera to actually look in the wrong direction. The actual ratios don't matter for picking (verified that). Still doesn't work in the PG though. Guess it's a problem with the alpha like @JCPalmer suggested. Is there any way to use the playground with another version? Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted January 6, 2017 Share Posted January 6, 2017 Yeah I was not sure if I was explaining it right, but that's kinda what I meant for you to check I'm glad you figured it out, I stay away from ortho if I can, unless I really need that projection. 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.