Hi I’m hoping someone can help me with this. I’m actually further along in the course but I’m revisiting Section_03 “FindComponentByClass()” because adding/pointing to a Physics Component seems to be a little different than other Actor Components.
I am aware that Physics handle has the BlueprintSpawnableComponent property hence why it’s probably best added in BP.
In a nutshell I’m using a ThirdPersonCharacter_BP based on the C++ class from the ThirdPersonTemplate and I want a Physics Handle component on it for grabbing and releasing objects in much the same way as the DefaultPawn in BuildingEscape.
I’ve followed the exact same process of: Adding the component via BP, creating a Private variable to store the Pointer, then finding in it BeginPlay.
But… for all that VS will not compile when I try to use FindComponentByClass.
It doesn’t complain if I leave the variable as a nullptr but that’s no use. I’ve spent quite a while trying to resolve this. Trying a Forward Declaration I suspect that didn’t work because the PhysicsHandleComponent.h file
doesn’t show up in the #include autocomplete list. I think it’s hidden on purpose but I don’t how change that and whether it’s even a good idea.
And soft coding a reference via a Blueprint callable function same as in the Battle Tank when finding the components on the tank. I got the furtherest using the soft coded method but as I expected VS still didn’t have any concept of the PhysicsHandle.
When I first did this part of the course I had absolutly no issue finding the component and having access to it’s members.
There’s no issue using it in the Event Graph of the CharacterBP the one the Gamemode spawns, but I would prefer to use it in code since I’ve done the same with every other actor component I’ve used so far.
All I can suspect is that CharacterClasses maybe don’t allow PhysicsHandle components to be used in code.
Here’s the repo on Github with the files in question any feedback is appreciated!