x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

NavLinkCustomComponent didn't work on level load.

Hey, i have tryed to make a derived class from UNavLinkCustomComponent to get an BlueprintSpawnableComponent that i can use to have a SmartLink on an Actor. I know i can make a NavLinkProxy derived class to get the same Result, but i need to change the SnapRadius of the SmartLink and therefore i have tryed to change the GetLinkModifier() function of the UNavLinkCustomComponent class. With the changes of the GetLinkModifier() funktion i get the expected result. The SnapRadius sets correctly, but the the SmartLink can't be used for pathfinding after level load. But the SmartLink will work fine if i build navigation (On next level load pathfinding still not working).

I used UnrealEngine version 4.12.5.

SmartLinkComponent.h file:

 #pragma once
 
 #include "AI/Navigation/NavLinkCustomComponent.h"
 #include "SmartLinkComponent.generated.h"
 
 DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FSmartLinkReached, AActor*, MovingActor, const FVector&, DestinationPoint);
 
 UCLASS(meta = (BlueprintSpawnableComponent))
 class MYPROJECT_API USmartLinkComponent : public UNavLinkCustomComponent
 {
     GENERATED_BODY()
 
     USmartLinkComponent(const FObjectInitializer& ObjectInitializer);
 
 public:
 
     UPROPERTY(BlueprintAssignable)
     FSmartLinkReached OnSmartLinkReached;
 
     UFUNCTION(BlueprintCallable, Category = "SmartLink")
     virtual FNavigationLink GetLinkModifier() const;
 
     virtual bool OnLinkMoveStarted(UPathFollowingComponent* PathComp, const FVector& DestPoint) override;    
 };

SmartLinkComponent.cpp file:

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #include "CrazyZombies.h"
 #include "Navigation/PathFollowingComponent.h"
 #include "SmartLinkComponent.h"
 
 
 USmartLinkComponent::USmartLinkComponent(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
 {
 }
 
 FNavigationLink USmartLinkComponent::GetLinkModifier() const
 {
     FNavigationLink LinkMod = Super::GetLinkModifier();
     LinkMod.SnapRadius = 8.0F;
     return LinkMod;
 }
 
 bool USmartLinkComponent::OnLinkMoveStarted(UPathFollowingComponent* PathComp, const FVector& DestPoint)
 {
 
     bool IsBaseDelegateBound;
 
     IsBaseDelegateBound = Super::OnLinkMoveStarted(PathComp, DestPoint);
 
     AActor* PathOwner = PathComp->GetOwner();
     AController* ControllerOwner = Cast<AController>(PathOwner);
     if (ControllerOwner)
     {
         PathOwner = ControllerOwner->GetPawn();
     }
 
     if (OnSmartLinkReached.IsBound())
     {
         OnSmartLinkReached.Broadcast(PathOwner, DestPoint);
         return true;
     }
 
     return IsBaseDelegateBound;
 }







Product Version: UE 4.12
Tags:
more ▼

asked Jul 31 '16 at 12:24 PM in C++ Programming

avatar image

DnS1989
1 1 3

avatar image DnS1989 Sep 23 '16 at 01:49 AM

Hey does somebody has a solution to the problem? Maybe MieszkoZ? I really appreciate any help you can provide :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question