another thing to keep in mind, AreaFlags NEVER changes to two… how can I change it to two??
I also tried using FVector:: Dist with the distance between the link and the AI, it crashes the engine to try :(… so getting the distance between the link and the AI to activate is out of the question Dx
You must have missed it from my initial description of how to pull this off with C++. This is required for navmesh generation to know this area represents “jumpable” connections.
Measuring distance between two valid vectors will never crash, which means you’re either trying to extract a location from a NULL pointer or passing some NaN values. I’d suggest you investigated that since it suggests you’re assumptions are wrong somewhere.
ok, correct me if I’m wrong, by doing this (1 << UUNavArea_Jump) when jump = 1, it will equal 2.
cause as I remember from binary, it would go up like this 1,2,4,8,16,32, etc… and that’s shifting it to the left. but wouldn’t shifting it to the right make it zero?
because if AreaFlags always equals 1, then it would look like this 0000001. Meaning shifting it to the left would be the case? (AreaFlags << 1) would then be 000010 making it 2 right??? thus when in the constructor code i forgot in my UUNavArea_Jump code would make the AreaFlags = 000010 if shift 1 to the right which would be the (1 << UUNavArea_Jump::Jump).
Sorry for this explanation… I just want to clarify if this thought process is correct MieszkoZ. Respond if this is either incorrect or correct.
it should check if the AreaFlags is 2 right? cause the binary slot would look like this 000010 which should be two. Another question I have is why does my AI lose movement when the player is on a linked NavMesh. only way i can get movement is if it’s on the exact same navMesh together.
No. “if(AreaFlags << 1)” passes if AreaFlags multiplied by 2 (equivalent of shifting left 1 bit) is not equal to 0. You just need to check if your flag is set amongst all possible flags in AreaFlags which in your case means simply bit-anding AreaFlags with 0x2.
Move request fails because only a partial path can be found and as such is a pathfinding failure. AI accepting or not partial paths depends on specific configuration.
Not setting [FONT=Lucida Console]AreaFlags to proper value was the reason it was not working for you initially.
Regarding partial paths these should get accepted by default, so I’d need to know your exact setup to be able to say more. I suggest you debugged your issue yourself - you’ll need the knowledge how to do it eventually anyway When debugging failed pathfinding [FONT=Lucida Console]UNavigationComponent::GeneratePathTo is a good starting point.
Thank you for sticking with me to help :)… I’m probably not the only one watching this thread too Dx.
As for this, the image below is my initial setup I have for the NavLinks. I was using the SideScroller Template level to see if it would work really.
basically, I have a Link to every step up. It’s also set to BothWays just to see if it can work really. They are all simple links, turned off the SmartLinks. and their AreaClass is UNavArea_Jump.
I plan to take a look at the [FONT=Lucida Console]UNavigationComponent::GeneratePathTo sometime today as well :). I will attempt to see what I can do… but in the meantime, take a look at the image above to see if the setup like that would be appropriate for the NavLinks.
Is it possible to implement jumping via blueprint? or is it going to be possible in the future? I just started getting my hands dirty with some of the behavior tree and ai stuff for my side scrolling shooter and it works great except my ai does not jump to places above him. He will “jump” or move to places below him, but nothing above.
I’m still trying to work on the Jump Navigation. slowly but surely getting it figured out. I will keep this thread up to date when I get this figured out. I still greatly appreciate this help so far :).
Currently it’s not possible to bake jumping information into a navmesh using blueprints alone. However it seems to be a popular request often enough to make it happen. In practice all that has to be done is to expose [FONT=Lucida Console]UNavArea::AreaFlags to BP, but we need to figure out a better way to expose it than simply exposing an [FONT=Lucida Console]uint16 value (it’s not really readable on its as such).
Did you get it working? I’m stuck with the (AreaFlags & JumpFlag) if statement always returning 0. The TestNavigationActors picks it up fine. My AI however, doesn’t.
My AI also just walks off the navmesh. I’m using MoveTo in a Behaviour Tree.
I’m working on a little tutorial on how to set this up. Give me some time to wrap it up, but here’s a basic C++ project that does that. Note that it has been build with master branch of UE4 so I’m not making any guaranties regarding compatibility with UE4 branches.
Hi MieszkoZ, thanks for putting up the tutorial. I followed it and am having 1 problem.
Edit: Closing the Editor and rerunning a couple times and it started working, I’ve noticed that it is inconsistent when changes come into the Editor. I’ll leave my initial comment.
The PathFollowing component is not being used, it doesn’t hit breakpoints in it. Here is where I set it, and the debug int breakpoint does hit.
Is the string important? TEXT(“PathFollowingComponent”), I tried changing this to see if it would change when I look in the Blueprint from the controller, but i think it is the default PathFollowingComponent.
ACatAIController::ACatAIController(const class FPostConstructInitializeProperties& PCIP)
int debug = 0;
Here are a few videos I have of my AI jumping code, including a new one I’ve just uploaded!
I explain my methodology below
**AI Jumping To Reach Specific Goal Across Nav Mesh Gaps**
In this video I am showing how my C++ AI code is helping my AI units to get across gaps in nav mesh / different nav mesh sections to reach a specific goal!
My C++ code is enabling the AI to reach places they could never reach without some carefully calculated jumps!
**In all of my videos all jumps are dynamically calculated**, I am not using navlinks of any kind!
The only setup I did was to place the navigation mesh volume, the rest is done by me in C++ !
I use [Navigation Mesh Point Projection](https://forums.unrealengine.com/showthread.php?25410-Rama-s-Multi-Threaded-Dynamic-Pathing-System-Full-Physics-Support&p=129896&viewfull=1#post129896) to keep the cost of all my AI analysis very low :)
Taking Jumping Shortcuts
AI taking shortcuts along known and good paths to shorten the journey!
In the above video, the AI has a good path to follow, and does not need to use jumping, but I do some nav point project calculations to determine when and where there are good jumping shortcuts that can be used!
See video for details!
I actually created my own PathFollowingComponent subclass!
Then I use a custom Controller, extending AIController,
and I overrode **InitNavigationControl()** to use my custom component!
**That's all there was too it!**
Now inside of:
the tick function of PathFollowingComponents,
I perform all my custom logic!
Enjoy the videos!