I have a inventory class that is derived by a empty class(none) and a AActor that inherits from this class. But I want to cast from the actor to the inventory and I get compile errors like this: no sutable constructor exists from AActor to Inventory.
Maybe I’m casting wrong or I’m using the wrong function but I can’t figure out the solution, thought I hope someone can help.
Here is the source code:
static_cast<Inventory>(outHit.GetActor());
The normal Cast doesn’t compile too:
Cast<Inventory>(outHit.GetActor());
Could It be that UE doesn’t support this option and I need to write my one cast function, but I don’t know how it works so I hope that someone shows me the right path.
Thanks a lot for every help and if my question was unclear or I didn’t provided enough information feel free to ask : )
if you write ur custom component class, you can later add it to the actor, and use that component methods and data for ur logics.
for example instead classic C++ scenario:
class WheeledAircraft : public Aircraft, public Wheeled;
you would do
class WheeledAircraft : public Aircraft{
MyWheelComponent* wheels;
};
notice! the last example is for logics, i don’t exactly remember how to add components via C++, it is a bit annoying syntax, so a bit of google on that will let you go.
tell me if you have some problems with it, it is a very complex field and has almost no support / tutorials on it. i’ve gone trough some of that ■■■■ so i will be more than happy to lend a hand.