Jump to content

Align ArcRotate camera alpha


Xav
 Share

Recommended Posts

Hi!

I'm having a problem with my camera alignment on the alpha axis.
I would like that when I click on a box my camera is aligned in the axis.
It works on small variation of rotation but if I pass on rotations higher than about 180 ° on my dome my camera makes a complete turn on itself and aligns itself.
Would anyone have a solution to fix the problem.
I probably do not use the good method I put you a playground with my code used:

http://www.babylonjs-playground.com/#XCGI1K

Thank you!

Link to comment
Share on other sites

Hiya Xav!  OMG, 6 days with no replies?  Sorry.

I looked at your code... it is very cool.  You are very inventive.

I think what we need, here... is... orientCamPerMesh(cam, mesh)  :)

That would make our life easier, huh?  I will keep thinking.  Perhaps others will help.

For future info, do you want camera to z-rotate to match mesh, too?  If so, perhaps good start is to parent (Universal?) camera... to an invisible/blank "camGizmo" mesh. 

Then, don't use camera alpha, beta, at all (not available on universal cam, if used).  Just use camGizmo to do all camera orientations/positioning.

When camGizmo orientation == mesh orientation... success!  (or something explodes and scares the dog)  :) 

I will work on this.  Sorry again for slow replies....I'm on it.

As-for animating cam/gizmo position/orientation to a DIFFERENT mesh-axis...  phew... that seems harrrrrd.  :)  Gods are nearby, though. 

I think we need "Quorbits".  Quarter-orbits... around the mesh (after doing an initial orientCamPerMesh(), of course (after someone codes it). 

Continuous/locked camGizmo.lookAt(mesh.position) might be handy, here, too.  Stay tuned.

Update:  I did some goofing-around with this playground... having some fun trying "meshAddingMode"  :)  [ link ]  Control-drag for ArcCam target-moving.  Many camera adjustments made, added click-on-dome -> re-init cam, added click-on-mesh -> camera.target == picked mesh.   Lots of experimental stuff.   I haven't begun anything difficult, yet.  I think I'm stalling.  :)

Link to comment
Share on other sites

Hello Wingnut thank you for your help.

I simplified the playground:

http://www.babylonjs-playground.com/#XCGI1K#7


There are now only two cubes. A blue and a yellow.
When we click on everything works (until everything is fine;).


The problem is that after several clicks in transition the camera makes a complete turn on itself?
The problem would not it that the camera returns an angle of 6.2831853072 rad for 360 ° at a time whereas finally one does only half turn of 3.1415926536 rad for 180 °?

Is there not a tool to normalize the angle of rotation so that it takes the shortest path rather than making a complete turn?

I hope to be clear enough in my explanation because you have to click several times to see the bug and the camera that runs a lot too.
 

Thank you.

Link to comment
Share on other sites

Hi @RaananW, thx4help!

   I still see a "long animation", under certain circumstances.

Run #8, then pan camera right... past the yellow box, past the blue box again, and then click on yellow.

I see camera alpha animation "unwind".  Anyone else see that?  Probably easier to see with slower animation.  *scratch scratch*

Link to comment
Share on other sites

Ok Xav, Raanan says it's time for helper-bail, so I guess you have all the tools to get the job done.  I have plenty of other stalled user-issues to work-on, so, good luck.  Thx for info/help, Raanan... I think you are correct... Xav has some new knowledge, now.  Me, too.

Give it a good try, Xav.  Holler-back later if you get stuck.

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...