AI Character not moving after changing default pathfollowingcomponent via ObjectInitializer


I have a problem with moving my AI character using behavior tree. The controller and character are created using c++ and behaviortree, blackboard logic via the UE4 editor. I’ve followed this tutorial to make my character jump, but after changing the default pathfollowingcomponent with new one using FObjectInitalizer, my character won’t move at all. Here’s my setup:


AMiniBossAIController::AMiniBossAIController(const FObjectInitializer& ObjectInitializer) :

When I change it to Super(ObjectInitializer), it works, but it won’t jump, cause I am not using my newly created pathfollowing component.


class GAME_API UJumpPathFollowingComponent : public UPathFollowingComponent

	UJumpPathFollowingComponent(const FObjectInitializer& ObjectInitializer);

	/** cached UCharacterMovementComponent */
		class UCharacterMovementComponent* CharacterMoveComp;

	// used to detect properties of a path's segment a character is about to follow
	virtual void SetMoveSegment(int32 SegmentStartIndex) override;

	// used to cache UCharacterMovementComponent we're using in SetMoveSegment implementation
	virtual void SetMovementComponent(UNavMovementComponent* MoveComp) override;

UJumpPathFollowingComponent::UJumpPathFollowingComponent(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)

//Never fires
void UJumpPathFollowingComponent::SetMoveSegment(int32 SegmentStartIndex)

	if (CharacterMoveComp != NULL)
		const FNavPathPoint& SegmentStart = Path->GetPathPoints()[MoveSegmentStartIndex];

		if (FNavAreaHelper::HasJumpFlag(SegmentStart))
			// jump! well... fly-in-straight-line!
			// regular move

void UJumpPathFollowingComponent::SetMovementComponent(UNavMovementComponent * MoveComp)


Character moves when I use the default pathfollowingcomponent, but whenever I change it, it doesn’t find the path to the target (doesn’t matter what’s the location of the target). I’m not familiar, what’s the cause of this problem.

Waiting for your response.
With regards.

Your last method is empty ?

Thank you for pointing it out (I feel terribly embarrassed about that), but the problem doesn’t seem to be in that function as SetMoveSegment function never gets fired (sorry for not mentioning that earlier). I tried to log out the value of CharacterMoveComp right before the (CharacterMoveComp != NULL) condition. I must have forgot about SetMovementComponent function because of that. I am not sure why SetMoveSegment function never fires.

The initialize function in the constructor is called out of desperation as I am not sure whether I should initalize something before. I didn’t use constructor earlier and it still didn’t work then.

I am not sure :), but maybe after you set the MovementComponent it will fire ?

I did set it up, but apparently it still doesn’t work. :frowning:

:(, can you try to delete the constructor ?

Still nothing. :frowning:

I found the solution for my problem. The problem was still in the SetMovementComponent function. Even tho I have experienced this alot of times, I still forget to call out the superclass’ function in the beginning of the function. The problem was only because of that again… :frowning:

Really annoying… Thank you for pointing out that I have empty function there earlier, I was too dumb to realize! :slight_smile: