Forum rules - please read before posting.

Disabling Right Click for interactions

Hi there,

I've got this whole system where right clicking has the character draw a gun and all interactions change to a shoot interaction.

The problem is that right click also puts the gun away but if you right click over a hotspot he triggers the interaction which shoots and the gun also gets put away.

So basically I just want to disable right click doing anything except for calling the active input action list that draws/puts away the gun.

Is this possible?

Cheers. 

Comments

  • You can use the Engine: Manage systems Action to disable the Interaction system completely.  That may be enough.
  • Problem is I'm using hotspots to handle the "shooting" interaction. I just turn off the normal hotspots and replace them with "shoot" ones when the gun is drawn. So I still need to be able to left click on them. If worst comes to worst I can just bind it to a different key but I'm trying to make it entirely mouse only. 
  • edited February 2016
    You could do it with a custom Action if you don't mind going into some code.  It makes sense to do so, as it's quite a unique thing you want to be able to do.

    I'm assuming the right-clicks are your "Examine" interactions?  What you want to do is basically have an Action that can disable / re-enable all Examine interactions within a scene:

    AC.Hotspot[] hotspots = FindObjectsOfType (typeof (AC.Hotspot)) as AC.Hotspot[];
    foreach (AC.Hotspot hotspot in hotspots)
    {
        if (hotspot.lookButton)
            hotspot.lookButton.isDisabled = true; // or 'false' to re-enable it
    }
    return 0f;


    That'll go in your Run() function. If you want to be able to set the true/false state in the Action's UI, create a public bool and make a EditorGUILayout.Toggle field in the ShowGUI function.
  • I'm using click then choose interaction mode so both left and right click do the same thing it seems. So I don't think the above is applicable. 

  • What are your exact interaction settings?
  • They are just click hotspot then click interact method. 

    All the "shooting" stuff is just me hiding and showing different hotspots. The "shoot" hotspots just have "single click interaction" selected. 
  • edited February 2016
    There's more to the interaction settings than just the Interaction method.  Please let me know all of them.
  • Hi Chris sorry for the massive delay, I've been tackling other problems.

    My interface settings are as follows:

    Movement method: point and click
    input method: mouse and keyboard
    interaction method: choose hotspot then interaction
    Select interactions by: clicking menu
    see interactions with: click on hotspot 

    Close interactions with: cursor leaves menu or hotspot

    The only tick box that is ticked is "dialogue options can be selected with number keys"

    Cant seem to find any other settings that effect interaction, let me know if theres any more you need. 

    Basically I want right click to register (as it runs a script) but not actually do anything in AC i.e. move the player or trigger hotspots. 
  • A right-click should have no effect on either movement nor interactions with that combination of settings - try it with the 2D Demo, which uses the same.

    How are you checking for a right click in your script?  If you're checking for Input.GetMouseButtonDown (1), try instead checking for an input button instead, that's created in Unity's Input manager and mapped to "mouse 1", which is the equivalant of RMB.
  • I've added an input in the input manager which is looking for "mouse 1" I am using this to activate an action list through the active input editor.

    I just tested it and right click is only triggering hotspots not movement. 
  • In the 2D Demo game?
  • No i meant in my game. I'm not really sure how I can test my settings in the 2D demo without importing it into my game and I'm worried that will mess something up.

    Even if I turn off my custom inputs it still makes right click trigger hotspots. It is baffling me.
  • It's important to check, because the issue will be down to the difference between the two - of which it's not yet clear.  First of all, try out the 2D Demo online to confirm how things should play.

    You can import the 2D Demo into your project without affecting your game - the only thing that affects your game is the set of Managers that are loaded.

    After importing the 2D Demo, choose Adventure Creator -> Getting started -> Load 2D Demo managers from the top toolbar and try out the demo scene, Park.  Assuming your right-click is the same as mine and has no effect in this demo, compare the settings between the 2DDemo_SettingsManager and your own.

    Once you've finished testing, you can re-assign your own game's Managers by finding the ManagerPackage asset file that was created by the New Game Wizard and clicking Assign managers in the Settings Manager.
  • edited June 2016
    I tried it on the 2D demo and it does indeed work as you say, no right clicking. I've no idea where it could be coming from in my scenes/managers. It looks the same as the 2D one. 

    In fact I just had to update AC to bring in the 2D demo and it deleted my custom inputs but I can still right click hotspots so it can't even be that!
  • I've done some testing and it just seems to be a problem with 3D. I loaded the 2D settings manager into my scene and just changed the camera type from 2D to 3D and that allows me to right click on hotspots. 
  • That same step does not cause that issue when running the 2D Settings in the 3D Demo scene.  Can you provide steps to recreate this issue with the demo games?
  • I added the 3D demo settings manager to my game and right click no longer worked on hotspots. I discovered that it's the Interaction Method that is effecting this. If it is set to "Context sensitive" right click doesnt trigger hotspots but if I change it to "choose hotspot then interaction" right click does work. 

    The annoying thing is I cannot recreate this in the demo no matter what I do. I've even loaded all of my managers and run the demo and still right click doesn't effect anything. So I suppose the problem must be in my scenes or hotspots somewhere? 
  • We can know for sure if you assign your own set of Managers, set the Camera perspective to 2D, and run the 2D Demo.  Place the 2D Demo player, Brain2D, in the scene before running so that it doesn't instead load in your own player.  If you can't right-click there, it should indeed be something in your scene.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.