Jump to content

camera position ?


Dad72
 Share

Recommended Posts

How do I retrieve the position of the camera on each axis separately. camera.getPosition.x does not seem to work

 

I would like that when i zoom on an object it remains in its position x and y. Because when i zoom on the object, it returns to its default position in x,y,z after observing/rotates ....

 

i used camera ArcRotateCamera for information. I use this function for zoom int, zoom out

function zoomIntOut(event)            {                    if(camera) {                        if(event.delta > 0) {                            iZ += 3;                            camera.setPosition(new BABYLON.Vector3(???, ???, iZ));                                                    }                        else if(event.delta < 0) {                            iZ -= 3;                            camera.setPosition(new BABYLON.Vector3(???, ???, iZ));                                                    }                    }                            }   

Thank you for help

Link to comment
Share on other sites

I cannot have the result that I want. (This is for a viewer of models)

I would like that the camera remains with its position in x, y (ok here) and rotation in x, y, z on ArcRotateCamera, but the result of my tests are not conclusive. My character is spinning when i zoom.

Thank you again for help

Link to comment
Share on other sites

sorry. I made a viewer of models for my editor.

 

When I turn the camera around the character and made a zoom, the camera does not remain on the position and given rotation.
I would like that if I turn the camera on its side to make a zoom on the hand for example, the camera zoom on hand. But here, the rotation is not taken into account, the camera does not remain face to the hand when i zoom. It could also be a zoom on the head as a view from above, but the camera does not stay on the top view.

 

See the function zoomIntOut(event) for the probleme

 

I use ArcRotateCamera for the camera.

 

I hope that you can better understand.

Link to comment
Share on other sites

You seem to update the camera position to zoom in and out, and I think your problem comes from here.

Did you try to use the parameter "fov" of the camera like this  ?

function zoomIntOut(event)            {                    if(camera) {                        if(event.delta > 0) {                            // You want to zoom IN                            camera.fov -= 0.1;                                             }                        else if(event.delta < 0) {                            // You want to zoom OUT                            camera.fov += 0.1;                                                 }                    }                            }   
Link to comment
Share on other sites

Thank you Temechon 

 

I had not the good method.  A documentation would have me help to find the solution.

camera.fov

is perfect And it fixed my problem. The result is exactly what I wanted. Thank you again.

Thank you also Deltakosh , and had not thought to try camera.radius, but Temechon my give a solution that works perfectly well.
 

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