Forum rules - please read before posting.

Hotspots intearaction via KB key

My Player has scripts inside that use the Fire1 and Fire2 for certain activities (exploding, animations..) so when I approach a Hotspot and use the Left Mouse button to activate it ..... it shoots, animates ,etc .

Can I use the classical USE keys like the keyboard key 'e' or 'f' to activate Hotspots instead?

Comments

  • You can interact with Hotspots via a triggering of an input named "InteractionA" - see the list of "Available inputs" in the Settings Manager.

    You will have to set your Input method to Keyboard And Controller in order to prevent mouse clicks also being registered by the interaction system.
  • I can't find "list of available inputs in the setting Manager" In section 2.8 of your manual it mentions InteractionA rather in conjunction with joysticks and not as  a possible feature for Hotspots. I find the 'e' or 'f' keys more prominent in games than mouse click to "use" something. Nevertheless I intuited that it was the Edit->Project-> Input Manager the one you meant.

    Furthermore in addition to the Keyboard and Controller one has to include also Context Sensitive in the Interface settings otherwise it does not work. 


  • edited November 2016
    As far as I know AC triggers "InteractionA" and "InteractionB" whenever there's a mouse click (left or right click), your movement settings should affect this though. The available list of inputs should appear in the AC settings manager, but it changes depending on the movement and control settings. Do have in mind that, that's a list of possible inputs you can use. To actually set them up you have to go to the Unity's Input manager and create the inputs with the same names as in the list (if I remember well). So if you want to give other keys that functionality just create an InteractionA and InteractionB inputs in Unity's input manager, and then assign whatever keys you feel like using. In the settings manager it would probably be good if you replace "Mouse and Keyboard" for "Keyboard or Controller" as the control settings (but that depends on what you have in mind for the player's movement).
  • If you can't find a list of available inputs in your Settings Manager, be sure to use the latest AC.  I don't know what version you're using, but it was added a while ago.
  • Alverik 

    Now I understand it. Chris said "You can interact with Hotspots via a triggering of an input named "InteractionA" - see the list of "Available inputs" in the Settings Manager" which for me was insufficient info but your following explanation "To actually set them up you have to go to the Unity's Input manager and create the inputs with the same names as in the list " paved for me a clear way on how to continue defining these inputs.

    Nevertheless now it works THANK YOU BOTH


  • joesan : sounds like you found a solution, otherwise I have a system like this working in one of my projects - would be happy to share screenshots of the settings.
  • The only way it works is by using exclusively this no other combination therein works :

    • First Person
    • Keyboard or Controller
    • Context sensitive

    But the movement is so jerky that the Player  cannot point precisely to an object (to shoot or grab) so, alas! I can't use it.

    I looked  at the Input Manager to see if the joysticks may influence the movement but I see nothing different, one thing which I don't understand is the line in all inputs settings:  "Joy Num: Get motion from all Joysticks"

  • edited November 2016
    Jerky? What are the rest of your movement settings in the Settings Manager? Can you post a few screenshots of your Settings Manager?
  • Jerky free-aiming?  Try reducing the sensitivity values in your First Person Camera component.
  • I've tried several 1stPersons (including TinPot) and the difference between using Mouse & Keyboard and  Keyboard or Controller is that when I move the mouse a mere millimeter either way with the former it changes 2-3 degrees y the 'y-axis' while the latter it swings to 7-9 degrees.

    I've been experimenting with movement settings in Setting manager to no avail also I reduced the sensitivity settings in the Project->Input Horizontal and Vertical Axes (may be Chris means another "sensitivity" settings which I fail to see within the 1st person character)

    Movement settings within the 1st person character: 2; 6;6;0;1;7 (corresponding to each line)

    and the Movement settings in the Setting manager: "Relative to Camera"; 6.15; 0.303;0




  • I was referring to the Freelook sensitivity option in the First Person Camera component, which should be on a child object of your Player.

    Aiming when using the Keyboard And Controller is intended to be done through either the keyboard or a controller, not the mouse.  A different algorithm is at work, meaning behaviour is going to be different if you start using the mouse.  If you want to aim with the mouse, use Mouse Or Keyboard input.
  • So in other words, I cannot use a keyboard key ('e' or 'f') to activate a hotspot if I use the "keyboard and controller" and since I use the mouse and not keybpard or controller to move my Player I can't do what I asked from the first day: Using a Player mouse-click to grab, shoot, animate, and using a keyboard key to activate a hotspot.
  • edited December 2016
    Open PlayerInput.cs and replace line 253:

    if (InputGetMouseButtonDown (0) || InputGetButtonDown ("InteractionA"))

    with:

    if (InputGetButtonDown ("InteractionA"))

    And line 279:

    else if (InputGetMouseButton (0) || InputGetButton ("InteractionA"))

    with:

    else if (InputGetButton ("InteractionA"))

    That will prevent the left-mouse button from having an effect when your Input method is set to Mouse And Keyboard.  I will look to make this optional in the next update.
  • I have been circumventing possible solutions and I found something but it's not so good as the one you propose and I am embracing it !!

    I will try it tomorrow and let you know... and thanks!!

  • It works beautifully !! thanks again
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.