Dear Chris, I have a slight issue that may or may not have something to do with the custom script we are using. I started a new scene. When I zoom in and use an item on an area outside of any specific hotspot, the camera flinches and centers on that area. It reacts the same if it is on Navmesh or outside of it. But it should not react outside of Navmesh at all. It should center only on the character when he has a successful interaction at a normal speed (other times, this works).
The confusing thing is that it works in my previous scenes. I start all by copying from the same scene template, but I cannot seem to find where the issue is. Can you please help?
There is one more thing. When playing on mobiles, the camera does not center on the player when interacting with a hotspot. However, it works properly when using the mouse on the desktop version.
When playing on mobiles, the camera does not center on the player when interacting with a hotspot
Best to sort these issues one at a time.
How does the camera's starting position, player's starting position, and background constraints differ from other scenes that work?
You mention a scene template: you're saying this works as intended? If so, copy it again and make the main changes (background, constraints etc) needed to turn it into the new scene - but do so step-by-step, so as to find out which step is causing the issue.
So, I took a scene that worked and a scene that did not work to compare them. I stripped them of everything and left only a background image (identical for both scenes), sorting map, navmesh, and playerstart.
I compared the Scene Manager in both scenes and went item by item through the Hierarchy of each scene. They are absolutely identical in all settings, but in one scene, everything works well; in the other, the issue persists.
Am I missing something/some specific setting or did perhaps one of the scenes get corrupted along the way?
If you have a stripped-down scene that works, best to use that as the basis for any new scenes by copying it each time you want a new scene.
If you have a broken scene with already-created Hotspots, logic etc, open both this scene and a new copy of your template scene and drag them over bit-by-bit, checking that the new copy scene works each step.
In the end, I found a scene that was not broken, stripped it down, and used it as a template, and it worked. I didn't find any differences, the other probably got corrupted along the way. But thank god I had one that was fine!
I encountered an issue when I wanted to teleport the Player to a new location using the Object: Teleport action. And it happens only sometimes.
For a single frame, the camera centers on the destination location where the Player teleports to it and immediately changes back to its previous (correct position). This causes the whole scene to flicker.
The "Also teleport camera" is unchecked. The camera movement along X and Y is locked, only zoom is allowed.
I'm not sure if it is caused by me setting something up incorrectly, the custom movement script, or if it is something else.
Comments
Dear Chris, I have a slight issue that may or may not have something to do with the custom script we are using. I started a new scene. When I zoom in and use an item on an area outside of any specific hotspot, the camera flinches and centers on that area. It reacts the same if it is on Navmesh or outside of it. But it should not react outside of Navmesh at all. It should center only on the character when he has a successful interaction at a normal speed (other times, this works).
The confusing thing is that it works in my previous scenes. I start all by copying from the same scene template, but I cannot seem to find where the issue is. Can you please help?
What's the custom script you're now using, and can you share a video of the issue? I'm not clear on the behaviour you're describing.
This is the script and i will send you the video in a PM.
https://paste.ofcode.org/tpebNP7PfvibxvVP9Sy2bn
There is one more thing. When playing on mobiles, the camera does not center on the player when interacting with a hotspot. However, it works properly when using the mouse on the desktop version.
Best to sort these issues one at a time.
How does the camera's starting position, player's starting position, and background constraints differ from other scenes that work?
You mention a scene template: you're saying this works as intended? If so, copy it again and make the main changes (background, constraints etc) needed to turn it into the new scene - but do so step-by-step, so as to find out which step is causing the issue.
So, I took a scene that worked and a scene that did not work to compare them. I stripped them of everything and left only a background image (identical for both scenes), sorting map, navmesh, and playerstart.
I compared the Scene Manager in both scenes and went item by item through the Hierarchy of each scene. They are absolutely identical in all settings, but in one scene, everything works well; in the other, the issue persists.
Am I missing something/some specific setting or did perhaps one of the scenes get corrupted along the way?
Nothing springs to mind, I'm afraid.
If you have a stripped-down scene that works, best to use that as the basis for any new scenes by copying it each time you want a new scene.
If you have a broken scene with already-created Hotspots, logic etc, open both this scene and a new copy of your template scene and drag them over bit-by-bit, checking that the new copy scene works each step.
In the end, I found a scene that was not broken, stripped it down, and used it as a template, and it worked. I didn't find any differences, the other probably got corrupted along the way. But thank god I had one that was fine!
I encountered an issue when I wanted to teleport the Player to a new location using the Object: Teleport action. And it happens only sometimes.
For a single frame, the camera centers on the destination location where the Player teleports to it and immediately changes back to its previous (correct position). This causes the whole scene to flicker.
The "Also teleport camera" is unchecked. The camera movement along X and Y is locked, only zoom is allowed.
I'm not sure if it is caused by me setting something up incorrectly, the custom movement script, or if it is something else.
The script is here: https://paste.ofcode.org/KaUVgmkZ7bm6p5W9tvSvSE
(i should add that the script sets up the camera to follow the player by default)
What would the correct behaviour be? For it to remain where it was?
Yes, the camera should not flinch/move when the Player teleports.
Commenting out the contents of the OnCharacterTeleport function will prevent it reacting to the Player teleporting.
Problem solved, thank you!