PREAMBLE
Ok. I'm a noob. Sorry. Working on it.

I'm going through the Ork tutorials fine, but my focus is 2D, so I thought I'd restart it and modify scenes to 2D and still try to move through them solving for 2D where I can.

I know the BrownPants character provided is set up with 3D movement which doesn't translate to 2d, so I know I'm going to have to set up a custom controller.

I set the player control type to "None" and set up a custom Control to reference a simple movement C# script I made instead, which is clunky but works for now.

Best case scenario, I'd like to use the controls from another unity extension "Topdown Engine" (by the corgi engine folks.) I've tried referencing their controller scripts instead but haven't gotten any to magically work out of the box yet, though I understand it just uses the native unity InputManager (not the newer input system.)

QUESTION
Is there a way I could I set up a custom controller to link directly to the Unity InputManager? That might work.

I know there are ORK 'Input Keys' which I can define the input origin to be from the Unity Input Manager from the dropdown list, but I don't know how I set up that functionality on a player controller. Maybe I just need to study it all further, I'm getting lost in a variety of control/map/key nomenclatures.

Any and all help is really appreciated.
Cheers
  • Are you trying to do a Legend of Zelda system for real time combat or some other system?

    Reason why I am asking I am doing a 2D Metroidvania Platformer and currently having a lot of success with a custom character controller so might be able to help you out here.
  • If you put a custom C# on character, and set controls to none then ORK has no control over your custom #. You have to modify your custom controller script to read different inputs from Unity. If it's in any Asset Store controller it will likely have a way for you to change inputs in inspector. If not, you can open C# file and look for code like Input.GetKeyDown(), Input.GetAxis("Horizontal") and change the text that gets fed to this function.

    For example Input.GetAxis("Horizontal") -> Input.GetAxis("CustomMoveAxis")

    If you wanted to use ORK to define all your inputs, you could modify C# and access ORK's input manager I think.
  • You can access ORK's input keys like this:
    if(ORK.InputKeys.Get(id).GetButton())
    id is the ID/index of the input key in the ORK editor.
    Or, to get the input axis:
    float axis = ORK.InputKeys.Get(id).GetAxis();

    Generally, you don't need to use ORK's controls for your custom control, unless you want to have the benefit of changing them via the ORK editor or e.g. adding virtual control via Control HUDs.

    When it comes to custom controls in ORK, check out the how-to on this. In most cases it's enough to use the None control type in ORK's game controls and define the name of your custom control component to let ORK know about it. If there's any special setup needed when enabling/disabling the controls, put that in OnEnable and OnDisable functions in your component - ORK just enables/disables the component when player/camera controls are blocked.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Hello,

    I'm sorry if this is a dumb question but I run into issues regarding this line:
    if(ORK.InputKeys.Get(id).GetButton())
    I can import ORKFramework and several other ORKsomething libraries, but can't seem to find something just called ORK. Also no matter where I search I can't find any InputKeys field (OrkFramework has InputKey but that doesn't seem to be it)

    It's the first time I'm trying to connect to ORK directly via C# so I'm probably missing something, but what? Do I need to import something else, or try to access a specific file in the scene or something?

    Thanks!
  • edited May 2020
    ORKFramework is the namespace, ORK is the central handler class that has static access functions/properties to conveniently access data and functionality.

    So, if you've got the ORKFramework namespace imported (using ORKFramework;), you're good to go and can access the input keys as per the code you posted.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • In hindsight that's pretty obvious yeah, my bad...

    Thank you!
Sign In or Register to comment.