Problem with recognise collision - Blueprint

Hi,
I created simple movement system without physic.

  1. Frame by frame I calculate new position for my Cube (“New Location” Pin)
  2. Then I use Multi Box Trace By channel for checking any collisions.
  3. Then I check collision result. If no, then I call Set Actor location and use"New Location" data
  4. If there are collisions, then I check if all of them implements BI_IgnoreCollisionInterface.
  5. if at least one of them does not implement that interface, I set “Can move” on false and break loop.
  6. If “Can move” is true, that’s means all Hit Actors implements BI_Ignore_Collisions interface and then I call Set Actor Location
  • I make all this steps for check vertical movement, forward movement and side movement.
  • I cant use sweep variable, becouse this check only one hit results. I have to check all of them
  • Box that Implements BI_Ignore_Collisions is simple box, simulate physics and gravity
  • Draw Debug Type print new boxes in right place (I think so :slight_smile: )

I think this is simple solution for checking if Cube can move or not, but sometimes cube stuck and can’t move. It’s looks like cube “penetrate” wall for few pixels. It’s really hard to debug and fix that. Maybe some of you see an error?

Hey @SamosDevel

I had a similar problem some time ago. I tried a bunch of different things but the only one that seemed to work fine was storing the last location and rotation before trying to move it.

Also I don’t use BoxTrace or Interfaces, I just use different trace channels to detect objects I want it to collide with or avoid.

I also used a bool to control “CanMove”, but I set it to True when the player presses the input, and to False when the player releases the input AND when the BlockingHit check is true. That way you stop accumulating attempts to move the box until a new input is pressed again.

There’s a good chance for collision checks and trace checks to fail if there’s a very small intersection between objects, so it’s better to avoid repeated attempts at moving the object.

Thx GRIM!. As a temporary solution I also store last location and set that position if are collisions after move. But I’m not sure is it the best solution ;]