I am having trouble with character movement during battles.
In the RPG I am creating, characters can move around the battle arena (it is not a grid-based battle).
There are two modes: one where the character walks toward the target, and another where the character simply moves straight forward or backward.
In the straight movement mode, I use the Move into Direction node, but the character forcibly moves forward, pushing allies and enemy characters aside.
I want to fix this so that the character stops when it bumps into the location of ally or enemy characters.

1)Is it possible to move straight forward or backward without specifying a target using the Change Position node?

2)Is it possible to make the character stop upon collision when using the Move into Direction node?

I would appreciate it if you could provide a solution.
  • 1) Yes, with To Object disabled you can define a target position - and using Local Space this is basically the same as moving into direction, e.g. X=0, Y=0, Z=5 will move 5 units forward.

    2) Not automatically.
    You could add a trigger around the combatant (prefab) that uses a Trigger Machine which stops movement (Stop Movement node) when something enters the trigger.
    Alternative setup with a Collision Machine can also work.
    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!
  • Thank you for your suggestion.

    The characters already have various components attached to them, and I wanted to avoid making the situation too complex, so I attempted method (1), which involves using only Schematics.
    However, I just remembered that I had already tried method (1) in the past, and it didn't work well, which is why I switched to the current Move into Direction node.
    Disabling 'Local Space' makes it work, but I have no idea why that is.
    I tried it again just now to make sure, but the characters still wouldn't move forward.

    I will also try method (2).

    By the way, I also attempted placing an empty object in front of the character prefab and having the character walk toward it, but the character only rotated on the spot and did not actually move locations.
Sign In or Register to comment.