please excuse my stupidness if i am doing something simple wrong but i am new to developing with unreal engine. What i am trying to do is move my character from start of maze to end of maze and have accomplished it using blueprints but i want to implement it in c++.
I Have assigned my characters AI Controller Class to my AIController.
The AI Controller should automatically possess the character when it spawns so you should be able to remove that bit. To get a reference to the controller you should call GetController instead of StaticClass.
Try setting a breakpoint in BeginPlay on the line where you cast to your AI Controller class. See if the variable ai is null or if MoveToLocation is failing.
Well, if it doesn’t cast to AIController then it’s either null or a PlayerController. This basically means whole your setup and/or assumptions are wrong and I suggest grabbing any on UE4 samples that have AI in it and see how it’s done there.
There’s a lot of places where stuff could have gone bad for you, so it’s a wast of time trying to solve it via an answerhub thread. Just look at samples.
Take a look at the UE4 sample project TopDown in C++. In that project the character moves where you click. This is done using the function MoveToLocation(…). It is very simple and well documented.