How do I cast the results of a trace?

I have a trace that returns an FHitResult but im having a lot of problems actually using that information. I want to attempt a cast on the hit component to a destructible component however I can find any way to convert the hit.component from TWeakObjectPtr to an actual UPrimitiveComponent that I can work with. The following code returns this error “‘Cast’ : none of the 3 overloads could convert all the argument types” Cast(hit.Component)

I get a similar error for any other converting techniques that I have tried but I feel like im missing something really obvious. Any help is appreciated

Its really about as simple as I posted above, I have a FHitResult and I just need to cast its component. As stated this code will not compile at all

`if (hit.Actor != NULL)
if (Cast(hit.Component))
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT(“HELLO WORLD”));


For some reason the code tool isnt working for me, Im not sure how to go back and fix it though

Hi zgjames,

Could you provide some of the code that you are using to try to accomplish this?

Try using:


Thanks! I figured it would be something obvious like that