Can't cast to USceneComponent...

Hello, can someone help me why i can’t cast UCapsuleComponent to USceneComponent?
I read this even from one of ue devs…
https://forums.unrealengine.com/development-discussion/c-gameplay-programming/32388-uactorcomponent-get-uscenecomponent

1 Like

You don’t need to cast it to a Scene Component because it already is one - you can just use it as it is.

TheJamsh is right. You can’t cast from a child to a parent because the capsule component will contain functionality that may not be in the parent (USceneComponent) and so the cast would lose this functionality.

Thanks for replies guys. Ofc that was the first thing i tried… i did this few times in blueprints which was pretty easy… but i need to learn c++ and this “error” is too difficult for me…
So when i set homing target directly as capsule component, its not working, as you can see in image.

Probably forgot to include the capsule component header?

1 Like

Thanks a lot! That was it! i was just confused because i already included character and i though it was already included… + that strange error…

The character header probably forward declares it, but that only tells the compiler it’s a thing that exists - not whether it is a USceneComponent. So that’s why you had to include it separately.