Unable to declare UPhysicsHandleComponent

Hi

I’m unable to declare UPhysicsHandleComponent and ATriggerVolume classes in VS2015. Basically Intellisense doesn’t recognizes them.

  1. I create a new Basic Code C++ project in Unreal
  2. I create a new C++ Actor Component class
  3. In the new Actor Component class created I just add this line, not touching anything else:
    UPhysicsHandleComponent* MyHandle

As you can see, Intellisense doesn’t detect UPhysicsHandleComponent:

When I hard code it, I get this:

85422-test_pointer.png

When I compile, I get this:

The same happens when trying to declare a ATriggerVolume class.

Is anybody having this problem or able to reproduce this issue?

Specs:

Unreal 4.11

Windows 10 Home - OS Build 10586.164

NVIDIA GeForce GTX 960 - Driver version 364.72

Visual Studio Community 2015 v14.0.25123.00 Update 2

Hello,

I’ve performed a couple of tests on different machines, but haven’t been able to reproduce your issue. I am able to add a Physics Handle Component to an Actor Component class successfully.

Do you get this same compiler error if you attempt to follow your repro steps in a clean project with no additional content?

Hi Sean

Sorry for the late answer. I’ve done several tests, reinstalling the OS several times and changing the installation order for UE4 and VS2015.

Conclusion:

  • If a use a Basic Code C++ Project and I add an Actor Component class, I have no problem declaring UPhysicsHandleComponent
  • If a use a First Person C++ Project and I add an Actor Component class, I cannot declare UPhysicsHandleComponent as per the screenshot errors.

Can you confirm that you have no problems declaring UPhysicsHandleComponent in a First Person C++ Project?

Hello,

The reason for this is that the First Person Template includes EngineMinimal.h in your project’s header file. The easiest thing to do would be to include Engine.h in your Actor Component class, as this will resolve your compiler error. Otherwise, you can go into your project’s header file and include Engine.h if you plan to use the features of that class in multiple classes in your project.

Have a great day

Thank you so much, this is exactly what I needed!

Had the same issue with UE 4.16.2 & Visual Studio 2017 Community and this solved my problem. Thanks for help!

In UE4.17, you can try:

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "PhysicsEngine/PhysicsHandleComponent.h"

instead of #include “Engine.h”.

Because importing “Engine.h” will require long time to Build the project.