I'm working with phase battles with an hexagonal grid. To move my characters on this grid, I use Call Function nodes with Grid Cell to Variable nodes to specify the grid coordinate. Then, in my code, I use an animation-based system in which the root motion of the root body part of characters is used to translate and rotate the character. This is good at preventing sliding, however, it's not super precise as I need to set some "stopping distance" in my agent to prevent my characters from circling around their destination point.

So, I wonder, is there any trick to make the characters move precisely in the centre of grid cells?

Also, I never managed to use the Controller Move option of the Change Position Node. Should I rename my custom component to CharacterController to make it work? And then, how will that work? Is there some interface or class to inherit from to make it communicate with the node?
  • Controller move requires a CharacterController component (one of Unity's built-in colliders), so renaming your component wouldn't help :)

    Since you're using a custom movement system, I'd need to know more details, e.g. how is the game object moved?
    A simple solution would be checking the distance between game object and target position each frame - if the distance is smaller than what the movement would be (probably move speed * delta time) set the game object to the target position.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks for the advice! I've solved my issue with some simple Lerps of the position of the character at the end of his movement.
Sign In or Register to comment.