When I am spawning a character during game-play → my character completely ignores collisions as well as failing to Walk at open spaces (completely flat ground, and sometimes appears to fly ).
However if placed in world by editor everything works fine.
Any ideas?
Relevant Part of C’tor
SetRootComponent(GetCapsuleComponent());
m_ActionManagerComponent = CreateDefaultSubobject<UActionManagerComponent>(TEXT("ActionManagerComponent"));
m_timerManagerComponent = CreateDefaultSubobject<UTimerManager>(TEXT("TimerManagerComponent"));
m_combatComponent = CreateDefaultSubobject<UBaseCombatComponent>(TEXT("Combat Component"));
m_onHitBloodEmitter = CreateDefaultSubobject<USphereComponent>(TEXT("OnHitEmmiterSphere"));
PrepareSphere(m_onHitBloodEmitter);
m_onHitBloodEmitter->SetupAttachment(GetCapsuleComponent());
GetCapsuleComponent()->OnComponentHit.AddDynamic(this, &ACBaseUnitCharacter::OnHit);
GetCapsuleComponent()->OnComponentBeginOverlap.AddDynamic(this, &ACBaseUnitCharacter::BeginOverlapEvent);
m_animationSoundComponent = CreateDefaultSubobject<UDynamicAudioComponent>(TEXT("AnimationSoundComponent"));
m_animationSoundComponent->SetupAttachment(GetCapsuleComponent());
m_actionSoundComponent = CreateDefaultSubobject<UDynamicAudioComponent>(TEXT("ActionSuondComponent"));
m_actionSoundComponent->SetupAttachment(GetCapsuleComponent());
m_otherSoundComponent = CreateDefaultSubobject<UDynamicAudioComponent>(TEXT("OtherSoundComponent"));
m_otherSoundComponent->SetupAttachment(GetCapsuleComponent());
//UCapsuleComponent* collisionCapsule
m_hardCollisionCapsule = CreateDefaultSubobject<UCapsuleComponent>(TEXT("HardCollisionComponent"));
m_hardCollisionCapsule->SetupAttachment(GetCapsuleComponent());
m_hardCollisionCapsule->OnComponentHit.AddDynamic(this, &ACBaseUnitCharacter::OnHardHit);
SetDefaultHardCollisionPreset(m_hardCollisionCapsule);
m_selectionBounds = CreateDefaultSubobject<UBoxComponent>(TEXT("SelectionBox"));
m_selectionBounds->SetupAttachment(GetCapsuleComponent());
m_selectionBounds->SetCollisionResponseToAllChannels(ECR_Ignore);
m_selectionBounds->SetCollisionResponseToChannel(ECC_GameTraceChannel3, ECR_Block);
m_selectionBounds->SetCanEverAffectNavigation(false);
m_selectionBounds->bGenerateOverlapEvents = false;
In Begin Play:
m_animationSoundComponent->AttachToComponent(GetCapsuleComponent(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, false));
m_actionSoundComponent->AttachToComponent(GetCapsuleComponent(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, false));
m_otherSoundComponent->AttachToComponent(GetCapsuleComponent(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, false));
m_selectionBounds->AttachToComponent(GetCapsuleComponent(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, false));
//m_hardCollisionCapsule->AttachToComponent(GetCapsuleComponent(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, true));
m_hardCollisionCapsule->AttachToComponent(GetCapsuleComponent(), FAttachmentTransformRules(EAttachmentRule::KeepRelative, true));
In BP class there is nothing much it just setting Default values etc…
Here is how I spawn it: