A -> B1
A -> B2
A -> B3
I just have a base class A with some components. And then I create a child B based on the base class, inheriting all the components. There are a few types of children B based on that parent class A and my raycast detect them by their base class A that is the same for all the children B. My player should attach the children to the socket in its mesh. The problem is that I can attach only the parent class A (by using its components), not its children B that inheriting the components from their base class A. How can I attach any of the children B by using the inherited components from the parent class?
AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetNotIncludingScale, SocketName); needs a valid component to attach to a mesh socket. It works ony for the base class A, not for its children B.
A(Component1, Component2) ->B1 (Component1[inherited], Component2[inherited])
A(Component1, Component2) ->B2(Component1[inherited], Component2[inherited])
IN MY PLAYER CLASS:-----------
B1
Component1[inherited]->AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetNotIncludingScale, SocketName);
B2
Component1[inherited]->AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetNotIncludingScale, SocketName);
I’m interesting in the process of inheriting of the Actor components. I wish to attach a child B by using its inherited from A component. I can attach only A, where the component is created, but I cannot do the same with B. Do I need to create the components separately for each children? Not inherit them from their parent?
Instead of creating components directly in children to use them for attaching, I created in their parent. And I wish to use them to attach children to the player.
Those children are just items that can be attached to the player. All the items are based on the same parent class, but their mesh can be different. Raycast detects the items and each of them can be attached/detached by pressing a key. They are detected by using their parent class that has the components created. Then, I cast the found parent class to see what item is and attach it to the player with using the inherited component. The problem is I cannot attach an item, only its parent class.
Question is: Can I use the inherited component to attach an object to a socket in a mesh? If so, how can I do that?