Download

Pushable/Pullable Block - Physics Constraint failing to connect two Actors

Hi all!

I’m implementing a pushable/pullable block mechanic for a third person game. I tried a Physics Handle, with limited success. The block could be pushed and pulled, but the distance between the player Pawn and the block didn’t remain consistent. The worst thing was that the player wasn’t stopped when the block was pulled into an obstacle - they just kept moving backwards away from the block. I need the two to become fully attached to each other, so I figured what I wanted was a Physics Constrain to ensure that the distance between the two always remains consistent.

As I have it set up, when the player presses a button, the player enters a grabbing state where the constraint is actioned, and stopped on button release. However, using either a UPhysicsConstraintComponent attached to the player Pawn, or an APhysicsConstraintActor spawned in the level, I can’t seem to get the system to work at all.

Things I’ve looked into and/or tried:

  • The constraint is spawned correctly (when using an APhysicsConstraintActor)
  • When checking in the Details panel, both Actors are correctly set (ConstraintActor 1 as the player, ConstraintActor2 as the block)
  • The constraint is at the correct world location, and when selected during PIE has two lines linking the two Actors
  • The block Actor is set to simulate physics
  • All Actors are in the same Level
  • IsBroken() returns false
  • I tried maintaining the position of constraint during Tick (when using an APhysicsConstraintActor)
  • I also optionally tried setting the relevant Components of each Actor
  • The Linear Limits and Angular Limits of the constraint are set to Locked
  • The two objects are not getting stuck in the floor
  • Unchecking the locked rotation (XYZ) and locked position (Z) values that I’ve set on the block does not change anything
  • The block’s root collision is set to enable Query and Physics, with a WorldDynamic object type and Mobility set to Movable

The result is that the player just walks away from the block and the block stays still. :confused:

I’m at a loss as to what else I could try, so if someone has some experience getting these to work, it would be much appreciated!

(Alternatively, perhaps someone could advise a better implementation?)

Cheers!
Bidds