edited September 2022 in ORK Support
Hello,

I am by no means a programmer, so forgive me if this all sounds like an easy fix. Beyond this, I feel like I will be using everything else in Ork 3 built in the way it is.

I have built my Player movement (Movement, Sprint, Jump, Gravity) in several PlayMaker FSM Templates that affect each combatant's character and animation controllers, but I can't figure out how to set those (or at least the one FSM "Movement" template) as custom components for combatant movement that will enable/disable upon switching characters.

Ideally, I would like to have the 3 party members spawned on the field (with the Ork 3 editor feature) and be able to switch through the grouped characters among them/switching the camera to focus on them as well (That part works great!), and then use some form of Move AI (NavMesh, maybe? - If the character controller isn't possible) to just have them follow the currently active character while the Playmaker Movement FSM is disabled. Any advice for the easiest way to set this up would be greatly appreciated!


Many thanks for your time and patience.
Post edited by jcw586 on
  • Didn't you email me about this?
    In case you missed it or the email didn't go through, here's the advice I gave:

    Did you check out the documentation on player/camera controls?
    There’s some information on using custom controls available as well.

    Basically, you just need to register components with ORK to allow ORK enabling/disabling them. You can also add multiple components to be turned on/off with player controls (or camera controls).
    In some cases you might need a wrapper component to work between ORK and your custom controls, e.g. if some additional setup is needed (e.g. setting the control’s player game object or something like that). The documentation has some examples for camera control wrappers.

    You probably already found the settings in ORK for player switching, if not, you can find that in Base/Control > Game Controls > ORK Game Controls > Group Member Keys. Alternatively, you can also use schematics (e.g. via global machines or machine components on game objects) to handle something like this.

    A move AI example to have the group members not controlled by the player follow the player is part of the 3D RPG Playground tutorials.

    The move AI supports NavMesh out of the box, but you can also use other solutions, e.g. here’s an extension to use A* pathfinding.
    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!
  • Thanks for your quick response. I didn't get an email for whatever reason.

    I'll have to go through the tutorials again. I tried once before and Playmaker was still giving me issues. I made a short script with OnEnable() and OnDisable() triggering the first Playmaker FSM it comes across on the gameobject and it is able to spawn the script on the player, enabled (so it turns on their first Playmaker FSM if it was off), but when I switch players, it doesn't disable that script, although I have the script entered in the Component Name field under the combatant's custom movement component. Do I need to place something in the move method or stop method fields?

    I will look into schematics next for sure. I got Navmesh to work for AI, so I just need to figure out turning off these PlayMaker FSM's upon switching. Schematics may be the right call.

    At any rate, thank you for the advice and I will be experimenting. :)
  • Doesn't have anything to do with custom movement components on a combatant - they're used on all combatants.

    You need to register custom controls (and other components that should be enabled/disabled with controls or when switching player) in Base/Control > Game Controls in the Player Settings > Control Behaviours. See the custom control documentation for details.
    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!
  • Perfect. Got it working, thanks!!
  • I ran into a new issue while trying out the A* MoveAI. It works, but when the characters reach their destination and stop moving, they still have Horizontal and Vertical float values being sent to the animator from the AI which breaks the animations and makes the characters continue walking in place. Rarely, the floats return to 0 as they should. I have the Animator set to return to an idle animation when the Animator's Horizontal and Vertical floats return back to 0.
  • If you're using the animation setup to forward the movement speed to your animator - that's based on the combatant game object's position changes each frame. So, if there are small movements still going on that'll be forwarded.

    What values are forwarded to the animator controller? E.g. are they very small (0.01 or so) or more like regular speed values (4, 5, etc.).
    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!
  • edited September 2022
    I'm not sure what values are being forwarded to the Animator. My animator has a lot of conditions that are in the .01-1 range, and two blend trees for right and left idle and walk animations that have ranges set up to be things like 1, 0 and 1, 1 for the horizontal and vertical float values corresponding to the axes. The "Movement" Playmaker FSM component starts disabled and only turns on when characters are being controlled so that isn't sending anything to the Animator floats for Horizontal and Vertical axis input. I'm guessing A* pathfinding is sending vector3 data to the Animator, and when it reached its destination it suddenly runs a stop() method that cuts everything off but still retains that vector3 information, because the Animator float values freeze at whatever they were at upon reaching the destination.

    This also happens when talking to an NPC - it will stop movement but be stuck with the character walking if I had any axis input upon hitting the button to speak with them. It probably has to do with telling them to face a certain way somewhere, but I'm not too worried about that as I can fix it all in schematics.

    Something else I should make note of is that I'm using 2D Spine animations for all the characters in a 3D world, so I have been turning off rotation and freezing it everywhere I can.
    Post edited by jcw586 on
  • edited September 2022
    You can see the values in your animator controller parameters when having a game object using it selected.

    Which player controls are you using? And if it's a built-in control, what's your setup?
    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!
  • edited September 2022
    Yes, those float values that I'm having trouble with in the Animator controllers are for the parameters "Horizontal" and "Vertical". I have Base/Control >Game Controls>Player Controls set to "None" because I added my wrapper script that enables the Playmaker FSM I built for movement as a Custom Control under Control Behaviors.

    Under Combatants>Combatants>General Settings>Default Movement Component I'm using A* AI Path. The Horizontal and Vertical float parameters are still recieving values in the Animator Controller while A* is active and the player controls (the Playmaker FSM controls recieving inputs and setting those floats in the animator controller) are disabled.

    I think A* or Ork3 is sending data to the Horizontal and Vertical float values in those Animator Controllers' parameters while following the player character, and then when the AI-controlled characters reach their destinations it just freezes those values in the animator controllers' Horizontal and Vertical parameters, so the animator controllers think that there is still horizontal and vertical (xz in my case) movement being applied to them. It locks in whatever velocity the character controllers had just as they reached their destinations. (Until I switch to one of those perpetually walking-in-place characters and it activates my playmaker fsm on them again which sends the axis input data to set the Horizontal and Vertical animator controller parameters again -- then they return to 0, 0 as normal and start idling again until I switch characters and they start to follow)
    Post edited by jcw586 on
  • Well, did you set up forwarding movement speed to the animator controller in the combatant's animation settings?
    Otherwise those values wouldn't come from ORK, unless you've e.g. added a machine component with a schematic that does this.

    The movement component of combatants is mainly used by AI controlled combatants for handling movement with the move AI. It's only used at other times when specifically set so e.g. in movement nodes in schematics.
    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!
  • edited September 2022
    I just realized the problem comes from my having the auto parameters under Animations, "Set X Move Direction" and "Set Z Move Direction" use the same "Horizontal" and "Vertical" animator floats as the "Set Horizontal Speed" and "Set Vertical Speed". If I turn off the Set Move Direction auto parameters, the combatants stop getting stuck with a value being sent to Horizontal and Vertical and both values return to 0 when they reach their destinations. Now I just need to figure out how to get Set Move Direction to work so my characters can face the direction they're moving without it somehow sending values to the Horizontal and Vertical animator parameters, and ideally only taking values from them to determine which way the character is facing.
    Post edited by jcw586 on
  • A different setup would be to use actual rotation for this. I'll change the 2D grid battle tutorials to use this in the future, as it's a better solution to the 2D direction problem.

    In short:
    - your player (or any other moving thing) rotates into movement direction
    - the sprite (animated) is a child object with a Face Camera component (makes it always face the camera and ignores the parent's rotation)
    - use ORK's animation setup to forward the rotation to a parameter, which you can also forward as 4- or 8-directional value instead of the the full degree of the rotation
    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!
  • edited September 2022
    I tried a character as a child with all the Spine data and the face camera component, but unfortunately I think Spine needs the animator to be on the same object as the sprite data, so no values are being sent to the child (sprite) object's animator if I make it a child of the rotating object. It appears that the movement values are forwarded from the parent's AIPath component to an expected animator on the parent and not the child. Unless it's possible some other way and I'm just missing something.
    Post edited by jcw586 on
  • edited September 2022
    I brought everything back to the way I had it where everything was working aside from Move AI facing the right direction and set the X Move Direction to my new Rotation float, changing my transition conditions for left and right movement states in the Animator to Rotation greater than 0 and Rotation less than 0 and it worked. Thanks for all the help! Will post an update again if it all falls apart somewhere, but for now I'm happy with what I have.
    Post edited by jcw586 on
  • edited September 2022
    This would just be icing on the cake, but is there anywhere to set Auto Move Speed Parameters for the Z Axis? Under Animations Settings it only has Horizontal and Vertical (for x and y).
    Post edited by jcw586 on
Sign In or Register to comment.