"UPhysicsHandleComponent" Doesn't want to be found!

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!

https://github.com/openchugs/AdventureExperiment

Hi,

I havent done this in C++ or on the third person but i have achieved doing this on the first person character template.
I followed the tutorial exactly and achieve it (albiet i moved the grabber key to a different button).
I included this as well as the footsteps blueprints i used in my building escape repo.

You are welcome to use it for a comparison.

Hey,
I wound up fiddling more and managed to resolve my issue. The physics handle isn’t actually tagged with the BlueprintSpawnable property I have no idea where that thought came from but at least in 4.12.5 it’s not in the header which I was looking at.

And VS not finding the PhysicsHandleComponent.h was simply due to it not knowing where to look. All I’ve done for now is #include the entire file path and that worked. So I’m actually constructing it in the ThirdPersonCharacter cpp file and using the pointer like that. Perhaps once Im more familar with VS I can resolve the file finding properly.

Still I wonder as to how it worked at all originally by just finding the component.

Privacy & Terms