Dad72 Posted November 13, 2013 Share Posted November 13, 2013 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 outfunction 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 Quote Link to comment Share on other sites More sharing options...
melaugui Posted November 14, 2013 Share Posted November 14, 2013 Hi,Did you try "camera.position" ? It gives you a Vector3 position of the camera. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 14, 2013 Author Share Posted November 14, 2013 Thanks ? This is where a documentation would be useful. I have no intellisense with my code editor. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 14, 2013 Author Share Posted November 14, 2013 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 15, 2013 Share Posted November 15, 2013 I do not understand the problem Could you be more precise? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 15, 2013 Author Share Posted November 15, 2013 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. Quote Link to comment Share on other sites More sharing options...
Temechon Posted November 15, 2013 Share Posted November 15, 2013 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; } } } Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 15, 2013 Share Posted November 15, 2013 With an ArcRotateCamera, if you want to zoom, just change the camera.radius value Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 15, 2013 Author Share Posted November 15, 2013 Thank you Temechon I had not the good method. A documentation would have me help to find the solution.camera.fovis 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. 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.