Is there a way to move an actor into the player component?


I am trying to implement some pick up logic. I have seen the wiki tutorial, but it is slightly different from my goals. I want the object the player picks up to jump from the world space into the player´s hands. I was wondering if it makes sense to move the actor into the player component or perhaps even the capsulecomponent–this way the picked up object would translate and rotate along with the player and it would probably be good for player collision checking as well, because I want the player movement to stop if the picked up block hits a solid wall for instance.

Is there a way to move the actor into the player component in UE? Or should I do this in a completely different way instead?

Edit: right now I have this:

It successfully moves the picked up object into the player capsule component, but for some reason the player starts flying away! I think the physics is messed up, maybe the player is colliding infinitely with the picked up object.

Edit 2: I set a different relative coordinate for the picked up object within the player capsule component, and now the player no longer flies away. So, I was wondering if there´s a way to make it so that the player won´t collide with this picked up object? Another thing I´m trying to get right is to make the player as a whole to stop moving if the picked up object inside the capsule component hits the wall.

Any help is greatly appreciated!

Hello. If I wanted the player movement to stop when the picked up object hits a wall, should I go with the ignorement approach or the removal of the collision volume?

What you have there is how you would attach something to a component. The reason you are flying away is because you are colliding with the item you hold. To fix this you either have to remove the colliding collision volumes or make them ignore eachother. Please refer to this answer.

If you remove the volume it will not collide at all. That means no stopping when meeting floors, walls or anything. This is only viable if you can replace the collision with something. For example, if you remove the collision on a helmet that you equip becasue your character volume covers it. In your case you want it to only ignore the stuff inside your own actor, so you would go with selectively ignoring a few things.

With this setup

I am able to move around freely without colliding with the picked up object, but the picked up object still does not prevent me from pushing it through walls. Do you have any ideas what I might be doing wrong? I think I am telling the Capsule Component to ignore the Hit Actor (which here means the picked up object). It does seem to work, but it the overall collision only covers the original capsule component´s collision, it does not include the picked up object now.

I am not sure why that does not work. I wonder if you have to make a custom channel for this. You shouldnt have to though. I dont have UE4 here atm so I cant test this myself, but This should work. Try doing something like a print statement on overlap. Is it actually registering the overlap or is it disabling the collision etc? I am sorry I cant help you any more than this.

If I don´t use “Ignore Actor when Moving” and move the picked up object slightly away from the player (relatively), then the player does not collide with it and does not fly away, but the object still won´t collide with walls. It seems like maybe AttachToComponent disables the collision of the picked up object for the outside world?

Another update: when the picked up object hits another movable object, it will actually push it over so it does in fact affect the world, but it just does not stop the player from walking forward and pushing the picked up object inside walls.

That is good. I just cant seem to remember what you have to do to incorporate that into the movement physics. Can you place a sub actor in there so that the subactors collision matches your item for testing purposes?

Also, make sure that the collision intercepts the walls. use collision presets block all.

If I place a static mesh representing the same object I usually pick up, it does show up as expected, but it will not affect the way the player hits walls or anything solid.

I can place all kinds of stuff under the player´s CapsuleComponent, but it will not affect how the player hits walls. The capsulae component has height/radius settings that define it.

You could try to use a physics handle to grab the item and then it will bend away. However, it will not block your users movement.