NodeCanvas Forums › General Discussion › NodeCanvas working with Apex Path?
Hey guys,
i’m just starting with NodeCanvas for a fps-project and it seems to be a nice tool so far. At the moment I use Unity Navmesh Agent, but I want integrate the new Apex Path engine for dynamic repathing. So I need a way to register for my enemies the Apex Agent instead of the Navmesh Agent – someone did that before or have some hints?
Is this possible at all with decent time expense?
Second question: NodeCanvas produces every time I open my project the error “More than one Global Blackboards exist with the same name ‘GameRoot_BB’. Make sure they have different names”, but there is only one blackboard. It seems to occur when activating global state for a blackboard. I use Unity 4.5.2f1 and nodeCanvas 1.5.31…
I have worked on the A* Pathfinding actions for NodeCanvas (in review for asset store), so I can possibly offer some assistance in helping you, I was looking at doing some actions for Apex Path however I could not see how it improved on the existing A* Pathfinding project (Aron Granberg’s) so didn’t bother.
The basic principle will probably be the same, you will end up basically getting your path, iterating round the path waypoints then move to them.
As far as your error goes it sounds like you have the same blackboard in the scene twice, just make sure the component isn’t duplicated etc.
Hey bbdata,
I think Apex path offers a steering agent component as well. If so and its a matter of calling something like SetDestination like you would do with NavMeshAgent, it would be something quite simple, else it would be something like grofit says.
I havent’t had the time to take a look at Apex path myself yet though 🙂
As for your question, this warning should come up if you have more than 2 blackboards with the same name AND also marked as Global (the radio button on the right on the blackboard name).
Is that the case? If so, simply rename the blackboard to something else. Meaning rename it’s name in the inspector, not the game object name.
If you don’t need those blackboards to be global you can simply turn off the Global option 🙂
Join us on Discord: https://discord.gg/97q2Rjh
Hey guys,
thank you for your feedback! I’ll dig in the Apex Path API the next days and try to get the necessary function calls. Since i’m designer and no programmer this will take some time ;-). @grofit I even didn’t know there are actions for Grandbergs A*, where can i find them? Looked at A*-project last year and it worked quite well after some initial problems..
The second blackboard with same name was untraceable, but i switched the blackboard to non-global and the error is gone.
I will post again as soon as I got a closer look at Apex.
They are on the asset store pending list as are cInput ones… however the asset store reviewers seem to be taking FOREVER to verify them. Although they are not free, as it is a pain maintaining A* stuff, as I helped out on the Playmaker versions as the original author of the PM bindings stopped developing and I needed to change some of his stuff for my own use cases, then A* was updated and the whole thing fell apart, so I have made them a commercial offering to cover the time involved in maintaining the bindings.
Hi I’m experimenting with NC-Actions and Apex now and facing some problems.
Using this simple script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
using UnityEngine; using NodeCanvas; using NodeCanvas.Variables; using Apex; using Apex.Steering; namespace NodeCanvas.Actions{ [Category("Apex")] [AgentType(typeof(Transform))] public class SeekTarget : ActionTask { public Transform other; private IMovable _unit; protected override void OnExecute() { _unit = this.As<IMovable>(); Mover(); } void Mover() { _unit.MoveTo(other.position, false); EndAction(true); } } } |
I get a NullReferenceException for _unit.MoveTo, means that the referencing in OnExecute doesn’t work.
Additionally there comes a “Graph Error ‘Infinite Loop Detected’ on node Sequencer” which is also produced by this script, the rest of the BT works fine.
I believe that one problem is, nodeCanvas works in his own classes and Apex presumes classes derived from MonoBehaviour?
At any rate the Script without nodeCanvas-elements as simple Monobehaviour works, it comes from a Apex Path tutorial.
So how can I reference these Apex classes correctly?
Hello,
The problem in your script is that you are casting the action itself as an IMovable instead of the agent. Furthermore you can use the IMovable interface type as the AgentType so that the whole action becomes smaller and reusable in case you want to override the agent. Specifying AgentType to be type of IMovable means that the agent needs to have an IMovable component since thats all that the action needs to work. Here is the script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
using UnityEngine; using NodeCanvas; using NodeCanvas.Variables; using Apex; using Apex.Steering; namespace NodeCanvas.Actions{ [Category("Apex")] [AgentType(typeof(IMovable))] public class ApexMoveTo : ActionTask { [RequiredField] public Transform target; protected override void OnExecute(){ (agent as IMovable).MoveTo(target.position, false); EndAction(); } } } |
Cheers
Join us on Discord: https://discord.gg/97q2Rjh
Oh no, oh yes, I was blind! You’re so right, I forgot the agent!
And to use the iMovable itself is ingenious 😉
Thank you very much!