I want to change the CapsuleComponent of my Character during runtime in C++.
It isn’t a problem with blueprints, but I struggle to do it in the code.
I am able to get a reference to the capsuleComponent with GetCapsuleComponent().
I can’t do anything with it though as the 2nd line will always show this error: ‘pointer to incomplete class type “UCapsuleComponent” is not allowed’.
UCapsuleComponent* capsuleComp = this->GetCapsuleComponent(); | |
---|---|
capsuleComp->CapsuleRadius = 30; |
The Components I created can be accessed like that though.
SpringArmComp = CreateDefaultSubobject(TEXT(SpringArmComponent)); | |
---|---|
CameraComp = CreateDefaultSubobject(TEXT(CameraComponent)); | |
SpringArmComp->TargetArmLength = 1200.f; |
Do I miss a step to get access to the capsuleComponent of the Character?