Announcement

Collapse
No announcement yet.

AttachActorToComponent not working

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

    AttachActorToComponent not working

    Hello,

    I'm new and learning UE4 and blueprints. I'm trying to make the mannequin pick up a ball. I've made a ball BP with only a sphere component. I added a socket to the hand of the mannequin and renamed it. Here is my BP in my character's event graph. Is there something I'm missing? Perhaps a checkbox? When I run this, it gives me an error message saying that the character's collision is already attached to character mesh.

    Thanks,
    dbzgod9
    Attached Files

    #2
    You have no target. You are trying to attach yourself to yourself. You need communication between two actors. One is the player character and the other is the BallBP class. The player needs a reference of that object, which is also the target. You could use some sort of trigger, like BeginOverlap, that would cast to your character blueprint who is controlled by get player character
    http://www.frostfire.ee Game development & resources

    Comment


      #3
      Hi xintoc, thanks for the quick feedback!

      What you said totally makes sense. I got it to attach to my actor, but once it does, the ball disappears. I can see the ball is attached to the character in the upper-right where it shows all the assets in the world and what they're attached to. I've never been able to click-and-drag the ball onto my socket in persona to preview its fitting. Would this be related to it disappearing in game?

      I've attached the BP I used. Seems like I could've also put this event graph in the ball (this is still the character) and CastTo the ball, but I was unsure how to reference the Mesh from my character. That would make more sense once I introduce more characters. I feel like I'm getting the logic and to figure out the steps that I need to program, but I'm lost in figuring out how to execute the logic, such as finding a way to reference a component in another class.

      Thank you very much!
      Attached Files

      Comment


        #4
        Make sure you add the socket to the right bone. Then choose how you want to attach it.

        This is the basic idea, but you can build your logic however you wish. Add input keys and conditions when the player can pick it up.

        Welcome.

        Click image for larger version

Name:	attach1.png
Views:	1
Size:	619.4 KB
ID:	1104892

        Forgot. Set the collision type to enable overlap events and overlap only pawn or whichever won't interfere. Or use a trigger box.
        Last edited by xintoc; 04-19-2016, 06:50 PM. Reason: PS
        http://www.frostfire.ee Game development & resources

        Comment


          #5
          Thank you once again for your help! This lesson was a real eye opener for me. Turns out, if you don't also set the collision to the ball's mesh to "no collision", you get weird movement glitches. I've attached my working BPs for closure in case this thread can help others was well.

          Your help was much appreciated!
          Attached Files

          Comment

          Working...
          X