Jump to content

Strange behaviour of the ArcCamera


Ahiru
 Share

Recommended Posts

Hi Ahiru

 

    I believe the camera is gimbal-locking, but I'm not completely sure about that.  Adding camera.upperBetaLimit = 3.14; (or less) should solve the problem.  3.14 is slightly less than Math.PI.

 

Math.PI is the default upperBetaLimit, happening when the cam is directly beneath the scene.  Setting it to 3.14 keeps the camera from extending to its full beta limit (Math.PI)... a place where gimbal lock is most-likely to occur. 

 

You can test this by setting camera.upperBetaLimit = Math.PI; which will cause the problem to remain/return.

 

Setting camera.upperBetaLimit = 3.15 ...also works, but maybe not as consistently as 3.14.

 

Excellent observations, Ahiru!  If this IS gimbal lock, it's the first time I have seen it happen right before my eyes.  Interesting! 

 

I THINK that the tiny value-offset from a dead limit like this... is called an epsilon value.  In our case, Math.PI - 3.14 = epsilon value. 

 

No promises, I'm far from being an expert in these matters.  :)

 

Be well!

Link to comment
Share on other sites

I will play definitively around with it - would be my first observation of these Gimbal-locking, too, but I thought internally the rotation is handled by quaternions?

 

For my taste I don't like the ArcRotate Camera have any Alpha and Beta limits at all, was very confused with this camera first to experience this locks. When I set up scenes I like to have the Beta limit totally removed.

 

But IF it is Gimbal-locking, maybe we can make a tutorial out of it to explain what it actually is?

Link to comment
Share on other sites

Hi again!

 

but I thought internally the rotation is handled by quaternions?

 

https://github.com/BabylonJS/Babylon.js/pull/630

 

"Warning here: only the followCamera uses the rotationQuaternion. All others cameras only use euler rotation"

 

Also... http://www.html5gamedevs.com/topic/14688-quaternion-arcrotatecamera - possibly of interest.  Bye again.  :)

Link to comment
Share on other sites

Yeah, I know, but I nulled them in this one already as far as I remember? (Unfortunately I can't check at the moment - my playground does not load)

 

So that's why I asked if there is any difference in yours and that one. (Maybe I missed something?)

 

But even now it behaves probably not like expected, will try that with a more 3D-Object soon. http://www.babylonjs-playground.com/#1RWE59#34

Link to comment
Share on other sites

Well, try to swing right left a bit, while yawning up. When reaching a special point you will see, that the right-left swing is interrupted and your mouse-swing works exactly turned like before.
 

Should be better with this one:

 

Maybe like this, but the scoll-wheel does not behave like I want.

 

http://www.babylonjs-playground.com/#YRIPX#8

Link to comment
Share on other sites

Sorry ambassador, but I have to disagree with you, unfortunately.

Open them side by side, and compare the movements if you turn them around.

The ArcRotateCamera shows unnatural behaviour, switching from a left to a right swing unexpectedly (from a user's viewpoint unexpected, not mathematically).

The second one is how I would expect a Rotational Camera to work? Maybe not perfect yet, but no sudden swings?

http://playground.babylonjs.com/#1RWE59#35

http://playground.babylonjs.com/#YRIPX#11

Anyone else agrees or disagrees?

Link to comment
Share on other sites

  • 2 weeks later...

Hi Ahiru​,

 

I fully aggree with you.

 

For an application working on win 7 with big touch screens in a production environment

we are testing to use the ArcRotateCamera for visualizing the processing of the current work piece.

 

In this scenario it's nearly impossible for the user to control the rotation of the ArcRotateCamera.

I've tried some optimizations, but ist not satisfactorily.

 

Your second one http://babylonjs-pla...s.net/#YRIPX#11 behaves much more as the user expects. Unfortunately the zoom function doesn't work with that. Do you already have found a solution for the zoom function to?

 

 

Best regards from Germany

Link to comment
Share on other sites

I was first thinking about using the Three.js way - rise or lower the FOV - but I don't like the stretching effects that come with it.

At the moment working on some Octree problem, but will come back to it for sure - if possible give it the same properties like the actual camera has.

Use the upper link (the #35) one and rotate a bit - you will see the jumping behaviour.

 

 

And how can I attach a video here?

Link to comment
Share on other sites

Since DK asked me to demonstrate the difference in a screencast:

 

ArcRotate.mov

ArcRotate3.mov

 

With ArcRotateCamera:

http://www.babylonjs-playground.com/#1PGAPW#4

 

With TemechonCamera:

 

http://www.babylonjs-playground.com/#1PGAPW#9

 

Try especially to do diagonal mouse-movements.

 

Using keyboard should work now, too.

Edited by Ahiru
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...