Using vectors to have a character slide a crate along the floor

I have tried a few options to have a character push a crate along a floor in a third person game.
While I can do it with physics and using a physics constraint it doesn’t exactly suit my needs because i end up with a few physics bodies interacting and it causes some problems.

Ideally i’d like to set the crate location based on the character location and the character forward vector but its not working great.

The first issue I have run into is that I have used a begin overlap event to determine when the character overlaps the crate. Then I use this to move the crate. But onbeginoverlap only gets triggered once so not sure how to keep the crate moving.

And then with the vector math I thought i would set the crates new location to the forward vector of the character (multiplied by a float greater than 1.0). But wasn’t sure if the forward vector of the character needs to be added to the vector location of the crate. Was just a bit confused by the vectors.

And finally tried using a projectile component to move the crate but couldn’t get it to move at all… Wasn’t sure which node to use with a projectile component.


@jmgold07 I don’t think you need to do any nasty vector math, you can just add to the world position of the cube.

When your player overlaps the cube, and is trying to move, you can use IsOverlappingActor or GetOverlappingActors to check if you still need to move it.

If you do, then just add to it’s world position using the forward vector from the player.

The forward vector will give you a unit vector, so you need to multiply if by 10 ( for instance ) and add it to the world position of the cube. That should do it…