Announcement

Collapse
No announcement yet.

trying to setup an Amor Component

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    trying to setup an Amor Component

    Hi there
    I'm tryin to create a class to handle armor things, I derived from scene component and reversed the child actor component to get multiples output.
    I'm actually having troubles to attach each part to a different socket

    Code:
    		if (Helmet)
    		{
    			HelmetName = Helmet->GetFName();
    			Helmet->AttachRootComponentTo(GetAttachParent(), "Helmet_Sck", EAttachLocation::KeepRelativeOffset);
    		}
    It actually spawns at 0.0.0. As far as I understand, I have only access to the main (Armorcomponent) Socket, and I cannot find the correct syntax... where and how should I call the attach to Parent Socket I should herit from SkeletalMeshComponent? I mean sould I write it in the character constructor or in the component one ? I tryed in blueprint also but position still 0.0.0.


    edit: I forgot to say I have another class deriving from Actor holding my skeletalmesh and other armor related variable
    I can post full code if needed or if anyone think it can be usefull
    Last edited by Whag; 01-01-2015, 08:10 PM.

    #2
    I tryed this kind of things in the character.cpp, compile fine but it crashes the editor...

    GetArmorComp()->Plastron->GetArmorMesh()->AttachTo(GetMesh(), "Plastron_Sck", EAttachLocation::KeepRelativeOffset);

    Comment


      #3
      Hey there,

      In my game i have mesh for every component of armor, and I call a function when a player clicks Equip on the item, and i use the following syntax to attach the item to my character mesh

      EquipmentSlots is an array holding pointers to the equipped items, and Mesh is the character mesh
      The AttachTo function looks for the slot by name on the mesh specified

      EquipmentSlots[SlotName]->StaticMeshComponent->AttachTo(Mesh, *SlotName, EAttachLocation::SnapToTarget);

      hope this is helpful
      My Works:
      Inventory and Equipment System | S.M.C (Simple Multiplayer Chat) | Spell/Ability System | Character Attribute Progression System

      Youtube | Website | Sellfy Page
      Fantasy 3rd-Person RPG , Skyland Of Arnythos

      Comment


        #4
        Yep I'll probably end up with an array, seems simpler. I'm trying this to understand the way components work (I'm pretty sure I'm not that far I'd like to know if I'm in a dead end or if I just miss the syntax. I saw in the wheel component they are declared static, could it mess with what I doing ? Not sure about how to do that
        The idea was to sum stats before transfering them to the player and have characters without armor, all presented in a "nice armor component"
        Last edited by Whag; 01-04-2015, 11:05 AM.

        Comment

        Working...
        X