void UNavMovementComponent::UpdateNavAgent(const UCapsuleComponent& CapsuleComponent) { if (ShouldUpdateNavAgentWithOwnersCollision() == false) { return; } // initialize properties from navigation system UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld()); if (NavSys != nullptr) { NavAgentProps.NavWalkingSearchHeightScale = NavSys->GetDefaultSupportedAgentConfig().NavWalkingSearchHeightScale; } NavAgentProps.AgentRadius = CapsuleComponent.GetScaledCapsuleRadius(); NavAgentProps.AgentHeight = CapsuleComponent.GetScaledCapsuleHalfHeight() * 2.f; }
void UNavMovementComponent::UpdateNavAgent(const AActor& Owner) { ensure(&Owner == GetOwner()); if (ShouldUpdateNavAgentWithOwnersCollision() == false) { return; } // initialize properties from navigation system UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld()); if (NavSys != nullptr) { NavAgentProps.NavWalkingSearchHeightScale = NavSys->GetDefaultSupportedAgentConfig().NavWalkingSearchHeightScale; } // Can't call GetSimpleCollisionCylinder(), because no components will be registered. float BoundRadius, BoundHalfHeight; Owner.GetSimpleCollisionCylinder(BoundRadius, BoundHalfHeight); NavAgentProps.AgentRadius = BoundRadius; NavAgentProps.AgentHeight = BoundHalfHeight * 2.f; }