0
\$\begingroup\$

I have game play scene in which user can zoom in and out. For which I used smooth camera in the following manner.

           public static final int CAMERA_WIDTH = 1024;
           public static final int CAMERA_HEIGHT = 600;
           public static final float MAXIMUM_VELOCITY_X = 400f;
           public static final float MAXIMUM_VELOCITY_Y = 400f;
           public static final float ZOOM_FACTOR_CHANGE = 1f;


            mSmoothCamera = new SmoothCamera(0, 0, Constants.CAMERA_WIDTH,
                            Constants.CAMERA_HEIGHT, Constants.MAXIMUM_VELOCITY_X,
                            Constants.MAXIMUM_VELOCITY_Y, Constants.ZOOM_FACTOR_CHANGE);
            mSmoothCamera.setBounds(0f, 0f, Constants.CAMERA_WIDTH,
                            Constants.CAMERA_HEIGHT);

But above thing create problem for me. When user perform zoom in and leave game play scene then other scene behaviour not look good. I already set zoom factor to 1 for this purpose. But now it show camera translation in other scene. Because scene switching time it so much small that player can easily saw translation of camera that I don't want to show. After camera reposition, everything works perfect but how to set camera its proper position.

For example my loading text move from bottom to top or vice versa based on camera movement.

Any more detail you want then I can able to give you.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

I can able to solve my problem with sudden camera jump using on update method. Following are the code snippet that I use to solve the problem.

mSmoothCamera.setZoomFactor(1f);
mSmoothCamera.onUpdate(10f);
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .