Hiya!
In 3 vs 3 combat, I'm looking to have combatants move to the center of the screen when they attack, along with their opponents, and then return to their initial battle positions. My initial thought was to introduce a 4th battle spot for both sides, but I'm struggling to figure out how to select the specific battle spot they should move to. Any suggestions on how to achieve this, or perhaps a better solution?
  • There are different ways to do it:

    1) The easiest is using the battle's game object, which you can use via the Battle Arena type actor (add it to the Settings node of your schematic).
    If your battle is placed at the center of your screen, that's basically all you need :)

    2) Otherwise, you can use a Raycast node to store the hit position.
    Using Screen raycast origin will send a raycast from the center of the screen. Use the Store Into Variables settings to store the hit position into a Vector 3 variable to use in other nodes.

    3) You can also use the center of all combatants, might not be the screen center, though.
    Use a Combatants type actor for that (has filters for defining which are used, default setup should use all combatants).
    When your movement nodes (e.g. Change Position) moves to an object, you can use the Use Center option to use the center position of all objects from the used actor, so if multiple combatants are stored in it, it'll use the center of all of them.
    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 October 2023
    Thanks for the suggestions! My characters have colliders, causing them to collide unexpectedly, which interferes with the intended results. I experimented with a few of your recommendations, but I need to address this collider issue before I can conduct a thorough test.

    Thanks!
    Post edited by Anoo on
  • You could set up the layer collision matrix to not have them collide with each other (see Edit > Project Settings ... > Physics (2D)).
    There's also the Ignore Layer Collision node available in schematics to do this in the running game.
    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 October 2023
    Thanks! The Ignore Layer Collision node is doing its job well!

    Regarding moving the combatant to the center of the battle arena, it's a bit hit-or-miss. Sometimes the staring object or the machine object moves, and occasionally they both move, but there are times when neither budges. The same unpredictability occurs when attempting to move them back to the base. Another issue is that they don't consistently end up in the center of the screen. I've experimented with various settings (center of combatants/center of battle arena), but I'm still struggling to get them reliably centered. I also gave the Raycast method a shot, but I could not get that working at all.

    (If I move just one combatant per action, such as only the starting object to the machine object and not both to the center, everything functions smoothly.)

    image

    image

    Post edited by Anoo on
  • edited October 2023
    This can depend on your combatant's game objects and how they're set up. Depending on that you might want to change the Change Position component's Movement Component setup. Changing it to Transform should always work, as that just moves by transform, ignoring physics, etc.

    In case you're using raycast to find the center, make sure there's something there (with a collider) that can be hit by the raycast.
    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!
  • I got it to work! Thanks!!
Sign In or Register to comment.