Pushing/Pulling Objects

I’ve been searching the forum for a solution on how to implement a push/pull object logic using Blueprint but could not find anything. Anyone here care to share how I can go about achieving this using Blueprint?

Hmm, no one ever tried doing this to share how they got it working?

What you want to do is attach the object you want to push/pull to your character. For that have a look at “Attach to Actor” node.

Along with that you might need some kind of animation. If you don’t have one, have a look at the new animation tools to alter existing animations. You might get away with the standard walk animation and some adjustments.

The “Attach To Actor” node part is what I’m having problems with. My issue has to do more with where each logic should go, and what nodes to use. Anyhow, I tried the following:

**1. **Create a new blueprint class of type actor.
**2. **Added a static mesh (sphere) and a sphere collision components.
**3. **Enabled physics
4. In the graph I created the following:
** **b.****CastToCharacter (to check if overlapping object is indeed the character mesh).
****c.****AttachToActor (target is set to character skeletal mesh - I’d also tried setting the target to a single bone).

*Unfortunately, that did not work. I was thinking about using something similar to how weapons are attached to characters (i.e create a socket & attach weapon to socket). But if I understand correctly that involves attaching the weapon manually at the blueprint editor level. Any break-down on where things should go might point me into the right direction.

Anybody else got any ideas they would like to share??

It would help if you could describe the feel you’re going for. Do you know any games with the specific way of pushing and pulling you have in mind?

Are you going for a physics based like Half-Life, or the character moving/snapping into position beside an object like Zelda and many top down adventures?

Yeah, the feel I was thinking of would be something where on-button-pressed stick to object to be pushed/pulled. As the object is being pushed/pulled move at reduced speed to give the impression of a heavy rigid body. The main thing is getting the stick to object part to work on-button-pressed. As for the speed, I’m thinking of getting the “character-movement” node and setting the “max-speed” to something slower.

Okay, you should try playing some more with the AttachActorToActor node, it is what you want. There are two options: attaching the character to the object or the other way around, but actually you should just attach the box to the character. :wink: This is because the character has autonomous movement, so it won’t work well to attach it to something else. On the other hand, the object doesn’t do any movement so can be safely attached.

Note that when you use AttachActorToActor, the Target should be the object Actor and the Parent should be the character Actor. Both parameters should be actors. I think you passed a skeletal mesh component before which wouldn’t work. You can also try AttachActorToComponent, in this case the parent can be your character skeletal mesh component.

Hello, can you help me, please.
I`m now trying to push/pull objects by character. What I have now: In pushable box BP OnComponentBeginOverlap → cast to ThirdPerson → Attach to Actor (target - is self (box), and parent actor- is Char),
in result: the box move forward when player moving,
BUT: when player rotate - the box also rotate, when I press A or D - they both rotate in that direction, when I press S - they also both rotate back (not going back).

Hi, I’m working in a movable pushing box blueprint, check my channel these days and I’ll upload the tutorial when I finish the blueprint.
I hope it helps :wink:

Warm regards

@McMedel Sisyphus would be proud!