In a 360-degree panoramic game, how to go temporarily to a 2D frame and then return to the EXACT position in the previous panoramic frame?
Tutorial:
1. First, create two new global variables of type "variant" named for example "LastX" and "LastY" (to do so, just click "VBSVariables" from the Adventure Maker menu on the left)
2. Then, go to the location where you want the game to move to the 2D menu frame. For example, it can be a hotspot, or the "Advanced" tab of the Project Properties if you want the menu frame to appear when you right-click or when you press Esc.
In addition to checking the option "Go to another frame" and choosing the 2D frame, also execute the following code to remember the current position in the panorama:
- Code: Select all
LastX = CStr(Component("AMPano").Object.GetHorizontalCameraAngle * 180 / 3.141593)
LastY = CStr(Component("AMPano").Object.GetVerticalCameraAngle)
3. Then, go to the location where you want the game to come back to the panorama. For example, it can be a hotspot with a text saying "Go back to the game". Or, if you have zoomed on an object, it can be a hotspot with a text saying "Zoom out".
In addition to checking the option "Go to another frame" and "Last visited frame", also execute the following code to tell the engine that the next panoramic frame should have the specified initial camera angles:
- Code: Select all
LastY = Replace(LastY, ",", ".")
AMPanoChooseViewpoint LastX, LastY
Note: the first line of the code allows supporting the systems that use a comma instead of a point for decimal numbers (I hope there are no other special formats in other countries, otherwise we will need to handle them here).