Page 1 of 2
User control - mouse wheel zoom in and out
Posted: Mon Feb 26, 2024 11:26 pm
by JamesDillon
I have a question about modifying Intrigues' mouse wheel zoom function.
I've used the Intrigues Demo scene to test integrating the Adventure Creator plugin with Intrigues. Overall, they work nicely together!
There's one key function, however, that Adventure Creator's 'GameEngine' component breaks: the zoom wheel used to reveal the map icons, ruling character, and info pop-up.
Here's how my Demo scene previews before going into Play mode:
Then when I enter Play mode, the zoomed in items disappear (as expected), but there's no way to zoom in and out:
'GameEngine' by Adventure Creator appears to be the culprit. Intrigues zoom works when I turn it off, but I then lose the Adventure Creator character spawn and movement system.
I have included 'GameEngine' info in these pics, if it helps:
Ideally, I would like to remove the Intrigues mouse zoom functionality and have Intrigues map data appear immediately on game start. Alternatively, I could also include Intrigues Zoom function in Adventure Creator, but am likely to remove the disappearing trick that Intrigues does to the map data.
Any assistance is appreciated.
Congrats on creating an excellent plugin for Unity.
Re: User control - mouse wheel zoom in and out
Posted: Tue Feb 27, 2024 9:49 am
by valqorr
Hey there,
Let me guide you through the steps to resolve your issue:
- Firstly, navigate to the Main Camera GameObject and Remove the 'PanAndZoom' component. This will disable the zoom and pan functionality provided by Intrigues.
- Next, use the search bar in the Hierarchy tab to search for 't:FadeSprites' and select all the GameObjects that appear. Remove the 'FadeSprites' component from these GameObjects to eliminate the effects applied by Intrigues.
- Lastly, Remove the 'FadeSprites' component from the 'Policy Icon' prefab as well.
After completing these steps, you should be able to seamlessly use another Pan&Zoom script.
Thank you for your positive feedback on Intrigues! It's great to know that you've had such a good experience with Intrigues. Your support and comments mean a lot to us. If there's anything else you'd like to know or if you need further assistance, don't hesitate to reach out. We're here to help!
Re: User control - mouse wheel zoom in and out
Posted: Tue Feb 27, 2024 7:59 pm
by JamesDillon
Success, yay! I removed the fade script from those items, and added the zoom function to Adventure Creator's GameEngine. It works. Thank you for your prompt and detailed reply.
I've posted a 5/5 star review Unity.
I look forward to the inclusion of a voting system. Anything you can add to Intrigues that enables non-dynastic Councils, Republics, and Parliamentary Governments would be a significant boon. The game I'm working on has a range of political factions, as I imagine does other games.
Re: User control - mouse wheel zoom in and out
Posted: Tue Feb 27, 2024 10:00 pm
by JamesDillon
Next challenge: clicking on the Intrigues map UI or the pop-up panels causes the character to walk towards that part of the map. The same when scrolling within the panel, it causes the map to zoom.
I'm not sure where to start to make the Intrigues UI content take precedent and prevent Adventure Creator movement and zooming from occurring.
Re: User control - mouse wheel zoom in and out
Posted: Tue Feb 27, 2024 11:01 pm
by valqorr
JamesDillon wrote: Tue Feb 27, 2024 10:00 pm
Next challenge: clicking on the Intrigues map UI or the pop-up panels causes the character to walk towards that part of the map. The same when scrolling within the panel, it causes the map to zoom.
I'm not sure where to start to make the Intrigues UI content take precedent and prevent Adventure Creator movement and zooming from occurring.
I'm sorry to hear about the issue you're encountering. While I'm not an Adventure Creator user myself, I'll do my best to provide you with some potential solutions based on your description and the images you've shared.
- From what I could gather, it seems like the 'Player Movement' component includes a Layer Mask option. By adjusting the layer of your interactive icons, you can prevent the character from moving towards that point when clicked.
- Regarding the issue of UI scrolling causing the map to zoom, a potential workaround could be to disable the Camera Movement component responsible for zooming when the UI window is open.
A simple way to achieve this could be through the use of UnityEvents:
- When opening the UI window, disable the Camera Movement component (e.g., 'PanAndZoom' or whatever component you're using for camera movements).
- Upon closing the UI window, re-enable the Camera Movement component to restore its functionality.
This approach should help prevent the camera zoom from conflicting with UI scrolling, ensuring a smoother interaction with your game's UI elements.
Please let me know if these suggestions help or if you need further assistance!
Re: User control - mouse wheel zoom in and out
Posted: Wed Feb 28, 2024 3:13 am
by JamesDillon
Thanks for your help, Wlabsocks.
I added an 'Unavailable' layer and turned off Unavailable in player character movement layers. No success, the character keeps moving towards the icon. I'll need to get a better grasp of how layers work in Adventure Creator (I tried searching in the AC forum on this topic but can't find a relevant post).
I then tried an alternative idea: I added an Adventure Creator 'Hotspot' zone around the Intrigues Character Icon, and gave the Hotspot a player interaction 'Do Nothing' assignment (it's the yellow box in first image below).
That did the trick, the player character now just opens the menu without moving. I will stick with this method for now.
As for the panel menu zooming issue, I followed your suggestion of adding a RunTime command within Actor/Clan/Active Schemes for On Page Loaded, but haven't found a '
Main Camera (Pan and Zoom)' option in Assets or Scene.
I found a PanAndZoom script, and an Adventure Creator MainCamera script, but none that looks like your examples (thanks for doing those, super useful).
Here's a screenshot of the closest I can find, 'PanAndZoom', with the option to add MonoScript.Name, but no option to enable or disable:
There are more options available for the Adventure Creator MainCamera script, but nothing that relates to Pan and Zoom:
Do I need to create '
Main Camera (Pan and Zoom)' script, or am I not looking for it correctly?
Thank you.
Re: User control - mouse wheel zoom in and out
Posted: Wed Feb 28, 2024 12:55 pm
by valqorr
PanAndZoom is the camera movement script I used in the Intrigues demo. You should disable the camera movement script you are currently using in your project. If you're still having trouble, I'll obtain the Adventure Creator asset to take a closer look and come up with a definitive solution for you.
Please keep me informed.
Re: User control - mouse wheel zoom in and out
Posted: Wed Feb 28, 2024 9:53 pm
by JamesDillon
Thanks for the advice.
I've identified two scripts in Adventure Creator that control movement:
PlayerMovement and
PlayerInput.
I can add them both into the OnPageOpened, but they don't have the 'Enabled' tick box function shown in your example, only 'Monoscript -> string name':
Here's a bit more info about PlayerMovement script located within the Adventure Creator folder, as I think that's the one that needs to be turned off:
Any advice on how to make these scripts Enabled/Disabled within OnPageLoad is appreciated.
Re: User control - mouse wheel zoom in and out
Posted: Wed Feb 28, 2024 10:19 pm
by valqorr
It looks like there's a bit of confusion in how you're attempting to disable the component using
UnityEvent. Dragging the script file directly into the
UnityEvent field targets the script as an asset, not as an instance of the component running on a game object in your scene.
UnityEvents require you to reference the specific instance of the
component attached to a
game object within your scene to effectively
enable or
disable it.
Here's how you can properly set this up:
- Select the GameObject: First, ensure the game object that has the PlayerMovement and PlayerInput components attached is selected in your Hierarchy view.
- Reference in UnityEvent: When setting up your UnityEvent (like OnPageOpened), drag this game object from the Hierarchy into the UnityEvent's object field in the Inspector.
- Choose the Component to Disable/Enable: After you've dropped the game object into the UnityEvent, you should then be able to choose the specific component (PlayerMovement or PlayerInput) from a dropdown menu of all components attached to that game object. This is where you can select the 'Enabled' property to toggle it off or on.
By targeting the component on the game object rather than the script file, you can directly control the component's enabled state via
UnityEvents. This approach ensures that the specific functionality you wish to disable (like player movement or input) is correctly managed without affecting the rest of your game's operations.
If you're still facing the issue, please let me know. I'll delve into Adventure Creator and aim to address both of your issue more efficiently.
+Q: Is the camera movement script you are using part of the Adventure Creator asset?
Re: User control - mouse wheel zoom in and out
Posted: Wed Feb 28, 2024 11:46 pm
by JamesDillon
Thanks for this advice and your patience.
I'm now adding 'GameEngine' components into the OnPageOpened, and its giving me the boolean option as you have presented:
The character is still moving with the above disabled, so I'll keep trying different options. I'll let you know how I go.
Understanding RunTime will be super helpful for me going forward.