Announcement

Collapse
No announcement yet.

How to attach a UCameraComponent to a capsule?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to attach a UCameraComponent to a capsule?

    Hello all. I'm very new to Unreal, but decently familiar with C++, so I've been following the FPS tutorial over in the docs (found here, in particular the step I'm struggling with.)

    My compiler is not very happy with the line
    Code:
    FPSCameraComponent->SetupAttachment(GetCapsuleComponent());
    saying that it cannot convert a UCapsuleComponent* to a USceneComponent*.

    I'm running Unreal 4.23, and I know that this tutorial is out of date, but it's been working so far. Has Unreal changed the way this is handled? How can I attach a camera to a capsule component? Is there a way to convert it into a scene component?

    I can't really find anything online to help me, so any help would be appreciated!
    My current code, with the above line:
     
    Spoiler

    #2
    The issue is that it doesn't know what a UCapsuleComponent is.

    Add this to the CPP file:

    #include "Components/CapsuleComponent.h"

    Comment


      #3
      Originally posted by TheJamsh View Post
      The issue is that it doesn't know what a UCapsuleComponent is.

      Add this to the CPP file:

      #include "Components/CapsuleComponent.h"
      That was it, thank you for the help!

      Comment

      Working...
      X