Hello,

I hope someone can point me in the right direction here, I apologise if I have missed something obvious.

So I am building a 2D action RPG, think Zelda ALTTP etc. I have set the horizontal plane to XY everywhere(I can find), specifically in the Game Settings and basically where ever I find it the framework. The player movement works fine, I have created the movement script and animations etc.
However, when I started adding enemies they are moving on the Z axis, they "flip" in the direction of the player and move towards them. When I look in the unity editor in 3D mode I can see the sprite moving through the floor on its "hunt". I have fixed the rotation and the position in the rigidbody 2d component of the prefab but it hasn't made a difference, oh and I have replaced the box colliders/RBs to the 2D variants etc. I'm spawning the enemies using the combatant spawner and a real time battle area.
I have also reviewed the How To on 2D games and made all the changes mentioned there, IE I have gone through all the settings and disabled the Ignore Y Distance settings etc.
I am using the Move AI for the enemy combatants and I am wondering if that's the problem? For 2D games should I be creating my own scripts for the AI? I was really hoping to avoid that and use ORK instead, I am quite new to c# and programming, hence why I bought ORK in the first place.

Any help is greatly appreciated.
  • How are your combatants moved by the move AI?
    This is defined by the Component Type setting - the move AI itself doesn't move your combatant, it only defines the position and speed to move to and forwards that information to whatever movement component you've set up.

    The Default component type isn't suited for 2D games, and I don't think that NavMesh is either.
    You'll have to either use a custom solution or a 3rd party product, there's e.g. a plugin available to support Poly|Nav 2D.
    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!
  • OK thank you for the clarification. I'm not sure then, that's very odd! I've just been following your tutorials but using 2D sprites instead of 3D models. The enemy sprites are moving around, I haven't added any movement components or scripts to the enemy prefabs. When I saw them moving I just assumed it was part of ORK/move AI. It was just frustrating that the sprites are moving around in 3D space instead of 2D. I will try the plugin and let you know how I get on. Thanks again.

    Best regards.
  • Hello

    So I have imported Poly|Nav 2D into my project and then imported the plugin. I have set the Component Type in move AI and in Base Control > Move to interact. I have also created a map and agent according to the Poly Nav documentation. However, I am getting the following error:

    Assets/ORK Framework/DLL/Scripts/Movement Components/ORKPolyNav2DWrapper.cs(12,11): error CS0246: The type or namespace name `PolyNavAgent' could not be found. Are you missing `PolyNav' using directive?

    I have checked the scripts and the namespace is there, so I'm not sure why ORK cant find it. Poly Nav seems to work fine outside of ORK. Can you help please? I'm probably missing something obvious. Thank you.
  • Hello,

    I fixed the problem, I was being stupid. I needed to add using PolyNav; to your plugin. All is working as expected now.

    You might want to change the plugin to reflect this, in the latest version (v 1.6.5) PolyNav is now in a namespace named PolyNav.

    Anyway thanks again for your support.

    Best regards.
  • Alright, thanks for the info - will update the plugin :)
    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!
  • @Talon I am getting the same issue you got, I am confused on how you resolved it..
  • @BND10706
    Well, same questions for you - are you using the move AI and what component/method are you using to actually move the combatants?

    I think he used Poly|Nav 2D and ORK's wrapper/plugin.
    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!
  • ya i figured it out i think the same way he did, I had to add the Poly to the scene. once I did that they spawned.
Sign In or Register to comment.