Resetting the View at exact center position

Q&A about the latest versions
Post Reply
NishantA23
Posts: 23
Joined: Mon May 17, 2021 10:51 am

Hi Hopki,

We are trying to create a button which would reset our zoom in values and align the camera to the exact center position of the screen. However, we aren't able to achieve this via the API calls mentioned in your documentation.

Here is the link on how is it currently performing - https://youtube.com/shorts/z8idXfHrU7o? ... Wa_AyUd97N

As shown in the video, we want the building to be center aligned when we click on the "Reset View" button, without changing camera position.

Can you please help us.

Thank you.
NishantA23
Posts: 23
Joined: Mon May 17, 2021 10:51 am

Hi Hopki,

Can you please help us to solve this. We are waiting for your answer.

Thanks.
User avatar
Hopki
Gnome
Posts: 13435
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi,
Can you say what the ‘Reset View’ button actually does?
What skin actions (if this is a button in the skin), or what API calls are you using?
The video is not really giving to much information.
Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
NishantA23
Posts: 23
Joined: Mon May 17, 2021 10:51 am

Hi Hopki,

This button is not in the skin. It's custom made. We are using obj.moveToXYZoom(obj.getX(), obj.getY(), 1, 2, 0, 0, 0.05);

What we want to achieve is that, irrespective of where user zooms on the whole screen, we want to reset the towers to it's center position.

We are aware of default view api call, but that also rotates the tower. We want to stay at the current frame number, center align the towers and unzoom entirely.

Hope this gives you clarity.

Hoping for a speedy reply.

Thank you.
User avatar
Hopki
Gnome
Posts: 13435
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi NishantA23,
The API is working as should.
Please see the attached project, you need Object2VR 4 and the latest build.
It is using a skin, but the button has the API call using a Go To URL action.
Regards,
Attachments
Toy Reindeer.zip
(287.87 KiB) Downloaded 49 times
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
NishantA23
Posts: 23
Joined: Mon May 17, 2021 10:51 am

Hi Hopki,

This works when image used is in portrait mode. But when used for landscape images, the same issue comes back.

If you use any landscape mode image, like 4320 X 2160 px in 16:9 aspect ratio, then we aren't able to center it back.

Can you please check.

Thank you.
User avatar
Hopki
Gnome
Posts: 13435
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi NishantA23,
Please see the attached project, it's a simple test using 4320 X 2160 px images made in Photoshop.
Using the same skin it's working as expected.
Maybe you could send your project to support for us to look at, link below.
Regards,
Attachments
test.zip
(921.52 KiB) Downloaded 38 times
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
NishantA23
Posts: 23
Joined: Mon May 17, 2021 10:51 am

Hello Hopki,

We did analyze the code and found out the exact cause. It's the image scaling value.

When image scaling value is set to 2, the code doesn't behave as expected.

In our project, since we want to place content correctly in landscape and portrait mode, we use image scaling value of 2.

Can you give us correct API call, when image scaling value is 2 in your project ?

Or can we have any workaround on this.

Thank you for helping us.
User avatar
Hopki
Gnome
Posts: 13435
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi NishantA23,
Just to confirm, when you are referring to the image scaling, you mean as found under the Image Settings in the Web Output, where you have Min, Max, Horizontal, Vertical and None.
We see this bug when we set this to Max, can you say what your setting is.
We will need to look into this.
Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
NishantA23
Posts: 23
Joined: Mon May 17, 2021 10:51 am

Hi Hopki,

Yes, we set the value of Image scaling to "Max" in the output settings.

Thanks.
User avatar
Hopki
Gnome
Posts: 13435
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi,
The values you are using, obj.moveToXYZoom(obj.getX(), obj.getY(), 1, 2, 0, 0, 0.05);
You seem to have to many numbers in the call as well.

It shoudl be:

Code: Select all

obj.moveToXYZoom(obj.getX(), obj.getY(), 1, 2, 0.5, 0.5);
So the middle of the screen is 0.5/0.5 and not 0/0.
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
NishantA23
Posts: 23
Joined: Mon May 17, 2021 10:51 am

Hi Hopki,

Thank you for your help. This worked for us !
Post Reply