So, I'm trying to figure out the best way to move and control an enemy in a 2d, top down, action rpg. I'd prefer to use Rigidbody2d/velocity so I can control the character's orientation with mecanim while having true collision, but ork doesn't seem to have a lot of options dealing with 2d velocity. I know Makinom handles 2d movement pretty well but that leaves the problem of dealing with ork's battle AI.

How can I manage the battle actions of an enemy while moving him around with Makinom/Rigidbody2d? Is it possible? If not, is there a work around so I can continue to take advantage of ork's many great features?
  • The Rigidbody event steps have options for 2D rigidbodies. The Movement steps mostly rely on a Character Controller for movement.

    The move AI only uses a simple (character controller) default movement script - but you can also use NavMesh and custom scripts. If you want to use rigidbody 2D for movement, you'd need to write your own script for a that. Or just use character controllers or NavMesh :)
    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 November 2015
    I'm not even sure where to start in writing a custom move component. So it needs a speed, position and stop method. How would I handle that using ridgidbody 2D?

    Edit: Okay, so the move AI sets the position the combatant is moving to with the use of the character controller while the simple move rotates the character in that direction with transform.LookAt also while controlling the speed it moves at. Unfortunately, I'm even more lost at how to replace this with ridgidbody 2D. There will be no rotation, only the change in X and Y velocity.
    Post edited by Dre788 on
  • This would be pretty much just getting the direction to the position from the current position, multiplying it by the speed and setting the velocity with it (probably multiplied by the delta time) - and this done each frame (i.e. in the Update function of your component.
    The direction can be calculated by subtracting the current position from the target position, e.g.:

    rigidbody2D.velocity = (targetPositon - transform.position) * speed * Time.deltaTime;
    speed is a float, targetPosition the Vector3 position you want to move to.
    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!
Sign In or Register to comment.