Hey I’m trying to register player character to CrowdManager but calling this function from bp does not work. Any idea what should I do?
.h
public:
UFUNCTION(BlueprintCallable)
virtual void RegisterAsAgent();
.cpp
void ACoreAgentCharacter::RegisterAsAgent()
{
UCrowdManager* CrowdManager = UCrowdManager::GetCurrent(this);
if (CrowdManager)
{
CrowdManager->RegisterAgent(this);
}
}
ACoreAgentCharacter should inherit from ICrowdAgentInterface and redefine theses functions:
FVector ACoreAgentCharacter::GetCrowdAgentLocation() const
{
return GetMovementComponent()->GetActorFeetLocation();
}
FVector ACoreAgentCharacter::GetCrowdAgentVelocity() const
{
return GetMovementComponent()->Velocity;
}
void ACoreAgentCharacter::GetCrowdAgentCollisions(float& CylinderRadius, float& CylinderHalfHeight) const
{
GetMovementComponent()->UpdatedComponent->CalcBoundingCylinder(CylinderRadius, CylinderHalfHeight);
}
float ACoreAgentCharacter::GetCrowdAgentMaxSpeed() const
{
return GetMovementComponent()->GetMaxSpeed();
}