Hello I’m having the following problem. After the help of Daekesh (via freenode.net#unrealengine) we were able to find out that the problem was that CABLECOMPONENT_API was missing in the class declaration, so it should be:
class CABLECOMPONENT_API UCableComponent : public UMeshComponent
I have entered a ticket regarding this issue to have it investigated further (UE-15620). The fix that you mention should work fine.
I see how the _API gives you access to the Mesh Component. But how can you look for the Actor in your class? You can’t add the _API think to the CableActor.
If I just try and test cast an AActor to an ACableActor I get the same linker error.
I also understand that these are plugins and you don’t necessarily want to create a dependency between game code and these. But if I add my own plugin to my game code, I know it is going to be there. I probably don’t even want it as a plugin since I want my game code to interface with it. But converting the plugin to native game code is also not clear to me.
I am not completely sure I understand what you are trying to do. Have you created a custom code class that contains a
CableComponent property, and you are trying to cast that
CableComponent property to
CableActor? If so, that won’t work.
CableComponent classes are two different classes. The only thing they have in common (besides the name) is that the
CableActor class contains a
CableComponent property (and nothing else). The
CableComponent itself contains all of the properties necessary to render a cable, and all you need to do is reference the
CableComponent to make use of it.
Thanks. To clarify.
I want to place the actor in the scene then have other actors like the player interact with it in code. Use case for example would be we want the player to climb a rope. We need to have a function in the CableComponent that returns the closest position to the cable along the cable.
Then when the player wants to “climb” it, he queries the world for a CableActor nearby then asks the CableActor for the nearest point on it. The Cable Actor can then query the cable component for this info.
I could add a cable component to the player actor. That use case would be more like the player having a “lasso” that he controls. But in this case, I want designers to put cables in the scene and have players able to interact with them.
It seems like if I just make a custom Actor in my game code that has the functionality of the CableActor and CableComponent, I get what I want. So I may do that.
I just thought it should be easy to use the CableActor as a plugin and have the player interact with it.
Sorry for the delay, this post slipped through the cracks.
You may have already solved this on your own, but I wanted to check in and see if you still had any questions. The
CableActor class unfortunately cannot be subclassed, but you can make a Blueprint deriving from it. I don’t think that is quite what you want, though. You may be better off creating a new
Actor code class that includes a
CableComponent (which would make it identical to
CableActor if that is the only thing that you add to it). You can then customize this
Actor class to do whatever you need it to do.
Thanks . That is what I did. I originally made my own Plugin. But then I realized I wanted to interact with it via the actor. So I made it a custom actor class. Now I can collide with and climb up the Cable. So it works great. Thanks.